0

If I use the @OnQueueCompleted(), so I can get the response from one completed job in the queue, am I right? Or the @Onqueuecompleted() only responds when all jobs in the queue are completed.

Please help

Erika
  • 453
  • 8
  • 23

1 Answers1

0

As the name implies, @OnQueueCompleted() decorator factory refers to the 'completed' event from Bull. Thus, your method will be called every time a job is completed in the queue.

Ref: https://github.com/OptimalBits/bull/blob/edfbd163991c212dd6548875c22f2745f897ae28/test/test_getters.js#L93-L115

Micael Levi
  • 5,054
  • 2
  • 16
  • 27
  • Thanks! So, for the @OnQueueFailed(), if one job is failed the first time,it calls the @OnQueueFailed() then wait for 1s and try the second time; it fails and calls @OnQueueFailed() again. It will wait for 2s and try the third time; this time, it is completed and call @OnQueueCompleted(). Am I right? Here is setting: {attempts: 5,backoff: { type: 'exponential',delay: 1000, } – Erika Dec 08 '21 at 17:21
  • I didn't use Bull yet tbh, so I'm not sure how this `exponential`. works. The only think I know is that if the job fails, then the method annotaed with `@OnQueueFailed()` will be called – Micael Levi Dec 08 '21 at 18:18