fixed batching and waiting priority plus cleanup

This commit is contained in:
Boki 2025-06-11 12:56:07 -04:00
parent d9bd33a822
commit 3097686849
6 changed files with 121 additions and 155 deletions

View file

@ -9,8 +9,8 @@ export class QueueService {
private queueEvents!: QueueEvents;
private config = {
workers: 1, //parseInt(process.env.WORKER_COUNT || '5'),
concurrency: 1, //parseInt(process.env.WORKER_CONCURRENCY || '20'),
workers: parseInt(process.env.WORKER_COUNT || '5'),
concurrency: parseInt(process.env.WORKER_CONCURRENCY || '20'),
redis: {
host: process.env.DRAGONFLY_HOST || 'localhost',
port: parseInt(process.env.DRAGONFLY_PORT || '6379'),
@ -141,7 +141,7 @@ export class QueueService {
});
this.queueEvents.on('failed', (job, error) => {
this.logger.error('Job failed', {
this.logger.debug('Job failed', {
id: job.jobId,
error: String(error),
});
@ -280,7 +280,7 @@ export class QueueService {
const jobType = jobData.type || `${jobData.provider}-${jobData.operation}`;
return this.queue.add(jobType, jobData, {
priority: jobData.priority || 0,
priority: jobData.priority || undefined,
removeOnComplete: 10,
removeOnFail: 5,
...options,