bullmq: BullMQ Pro Job `timeout` usage

Im able to use the ttl on the worker, but not all the jobs on the worker need the ttl. I see the timeout on the job but it doesn’t seem to work .

Is there a way to TTL per job without doing this

const worker = new WorkerPro(queueName, processor, {
  ttl: { test1: 100, test2: 200 },
  connection,
});

our workers / jobs are decoupled for the most part .

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

@manast Yes, for example the whole QueueScheduler thing. It is a very complex architecture which doesn’t feel “natural” and is explained with like 2 paragraphs.

It would be good, if things are explained in detail with examples what will happen under the hood.

For example: “When a job is in an active state, i.e., it is being processed by a worker, it needs to continuously update the queue to notify that the worker is still working on the job.”

What does that mean? Who has to notify the queue? The worker itself? This job processor? How often, what does “continuosly” means? How does the QueueScheduler recognize that a job is stalled? You wrote “i.e.”, are there other possibilities of a job being active without being processed by a worker?

To have answers to these questions would help to understand the whole library and to understand for example the purpose of Schedulers.

Or why do I have to use an observable when I want to use ttl? As a developer I see no reason why this shouldn’t work also with Promises, so it would be nice to have a explanation for this. Or why do I have to return a named unsubscribe function in this Observable. Would an anonymous arrow function also be ok? Why don’t you wrap the processor in an observable by yourself in the first place? Why do I have to make it? 😄

And then the whole timeout part is under a section named “Observable” and then “Cancellation”. Why isn’t it under “Job” -> “Timeout” where it belongs? Instead of structuring the documentation in the way a developer will use your library, you structured your documentation in the way you have solved common problems:

  • I don’t want to know, what a QueueScheduler is, I want to know how to resume jobs ofter my microservice has restarted. Never ever would I look into QueueScheduler.
  • There are two Flows sections.
  • Real Time Updates is just empty.
  • Sender - Receiver also.
  • The Api Doc from TypeDoc is very chaotic. This was absolutely not the best choice…

I hope this helps! Thanks for your open ear!