A
A
Alexander Knyazev2016-03-26 22:57:17
JavaScript
Alexander Knyazev, 2016-03-26 22:57:17

Kue. What is it and what is it eaten with?

In practice, over the implementation of nodejs - applications. We were given the task to understand what npm is - the kue module and use it to implement queues for requests to the server. If you turn to the official page on Github - everything is written there for people who are already familiar with the problems that this module should solve.
I understand the basics of what it is.
What can you advise to google / read?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pomeo, 2016-03-28
@pomeo

Regular queues with data storage in redis, everything is in the documentation.
Something that is not in the documentation, TTL appeared from version 0.9, you need to install it. If you skip done();, and I guarantee you that you will stick them for months in all places of complex tasks, then the task will fall off by timeout. You need to catch errors everywhere when your task is being processed. Skip, timeout is not worth it, the task has risen. Even if it is, the task will not be completed. And if you are already using queues, then it will not be one task, but hundreds of thousands or millions.
You also need to clean the database from job failed. Only job success is removed if removeOnComplete(true) is set. But failed must be cleaned by hand, the documentation describes how to do it. You will not clean, something may go wrong and the radish will gobble up all the memory.
It is necessary to configure graceful shutdown.
In the latest versions, search by tasks is disabled, if you do not need it, do not enable it.
If you don't need job events, turn it off. Radishes will noticeably lose weight.
If your radish memory grows, tasks will stop and a bunch of other errors around kue. Then 99.9% that the problem is in your hands, and not in kue. A person with "jobs stuck" appears in issues every couple of weeks and this is just 99.9%

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question