Refactor API and worker applications to use NestJS framework. Update package versions and scripts for improved functionality. Enhance TypeScript configurations and add new dependencies for better development support. Remove deprecated main.ts file from worker application.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Worker, type ConnectionOptions } from 'bullmq';
|
||||
import { Job, Worker, type ConnectionOptions } from 'bullmq';
|
||||
import IORedis from 'ioredis';
|
||||
|
||||
import { validateConfig } from '@hexahost/config';
|
||||
@@ -20,7 +20,7 @@ function createQueueWorker(
|
||||
): Worker {
|
||||
return new Worker(
|
||||
queueName,
|
||||
async (job) => {
|
||||
async (job: Job) => {
|
||||
logger.info(
|
||||
{ queue: queueName, jobId: job.id, jobName: job.name },
|
||||
'Processing job',
|
||||
@@ -42,11 +42,11 @@ async function bootstrap(): Promise<void> {
|
||||
);
|
||||
|
||||
for (const worker of workers) {
|
||||
worker.on('completed', (job) => {
|
||||
logger.info({ queue: worker.name, jobId: job.id }, 'Job completed');
|
||||
worker.on('completed', (job: Job | undefined) => {
|
||||
logger.info({ queue: worker.name, jobId: job?.id }, 'Job completed');
|
||||
});
|
||||
|
||||
worker.on('failed', (job, error) => {
|
||||
worker.on('failed', (job: Job | undefined, error: Error) => {
|
||||
logger.error(
|
||||
{ queue: worker.name, jobId: job?.id, err: error },
|
||||
'Job failed',
|
||||
|
||||
Reference in New Issue
Block a user