fixed batching and waiting priority plus cleanup
This commit is contained in:
parent
e4d5dba73a
commit
6fb98c69f2
6 changed files with 121 additions and 155 deletions
|
|
@ -122,11 +122,11 @@ async function processDirect<T>(
|
|||
provider: options.provider || 'generic',
|
||||
operation: options.operation || 'process-item',
|
||||
payload: processor(item, index),
|
||||
priority: options.priority || 1,
|
||||
priority: options.priority || undefined,
|
||||
},
|
||||
opts: {
|
||||
delay: index * delayPerItem,
|
||||
priority: options.priority || 1,
|
||||
priority: options.priority || undefined,
|
||||
attempts: options.retries || 3,
|
||||
removeOnComplete: options.removeOnComplete || 10,
|
||||
removeOnFail: options.removeOnFail || 5,
|
||||
|
|
@ -179,11 +179,11 @@ async function processBatched<T>(
|
|||
totalBatches: batches.length,
|
||||
itemCount: batch.length,
|
||||
},
|
||||
priority: options.priority || 2,
|
||||
priority: options.priority || undefined,
|
||||
},
|
||||
opts: {
|
||||
delay: batchIndex * delayPerBatch,
|
||||
priority: options.priority || 2,
|
||||
priority: options.priority || undefined,
|
||||
attempts: options.retries || 3,
|
||||
removeOnComplete: options.removeOnComplete || 10,
|
||||
removeOnFail: options.removeOnFail || 5,
|
||||
|
|
@ -233,11 +233,11 @@ export async function processBatchJob(jobData: any, queue: QueueService): Promis
|
|||
provider: options.provider || 'generic',
|
||||
operation: options.operation || 'generic',
|
||||
payload: processor(item, index),
|
||||
priority: options.priority || 1,
|
||||
priority: options.priority || undefined,
|
||||
},
|
||||
opts: {
|
||||
delay: index * (options.delayPerItem || 1000),
|
||||
priority: options.priority || 1,
|
||||
priority: options.priority || undefined,
|
||||
attempts: options.retries || 3,
|
||||
},
|
||||
}));
|
||||
|
|
@ -288,7 +288,7 @@ async function storePayload<T>(
|
|||
processorStr: processor.toString(),
|
||||
options: {
|
||||
delayPerItem: 1000,
|
||||
priority: options.priority || 1,
|
||||
priority: options.priority || undefined,
|
||||
retries: options.retries || 3,
|
||||
// Store routing information for later use
|
||||
provider: options.provider || 'generic',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue