Add logs to debug worker performance on production (#14712)
As per title, just adding worker job execution time
This commit is contained in:
+6
-1
@@ -72,12 +72,17 @@ export class BullMQDriver implements MessageQueueDriver, OnModuleDestroy {
|
||||
queueName,
|
||||
async (job) => {
|
||||
// TODO: Correctly support for job.id
|
||||
const timeStart = performance.now();
|
||||
|
||||
this.logger.log(
|
||||
`Processing job ${job.id} with name ${job.name} on queue ${queueName}`,
|
||||
);
|
||||
await handler({ data: job.data, id: job.id ?? '', name: job.name });
|
||||
const timeEnd = performance.now();
|
||||
const executionTime = timeEnd - timeStart;
|
||||
|
||||
this.logger.log(
|
||||
`Job ${job.id} with name ${job.name} processed on queue ${queueName}`,
|
||||
`Job ${job.id} with name ${job.name} processed on queue ${queueName} in ${executionTime.toFixed(2)}ms`,
|
||||
);
|
||||
},
|
||||
workerOptions,
|
||||
|
||||
Reference in New Issue
Block a user