embedded-queue
embedded-queue copied to clipboard
about delay queue
**How to use the implementation delay queue?
For example, the queue task is executed every 10 seconds or a certain value**
Currently, that feature is not available.
Currently, that feature is not available.
How to perform some timed tasks when I am performing tasks?
After the execution, I paused using the timer to enable it and found that an error would be reported this._currentJob is not null
Queue. shutdown
is not method for pausing queue, it terminates queue.
That queue will never be used again.
Queue. shutdown
is not method for pausing queue, it terminates queue. That queue will never be used again.
Then how should I suspend the queue
My task is asynchronous, I want him to continue after performing a lot of actions
Now after using process, all actions will be executed quickly
this.queue.process( QueueEunm.SEND_MSG, async (job) => { // logger.service.info(job, QueueEunm.SEND_MSG +'Queue consumption...'); job.data; }, 1 );
Then how should I suspend the queue
In the current implementation, the queue can only process the added jobs immediately. We have found that there is a demand for the new feature, but it cannot be implemented immediately.
In some cases, a close result may be achieved by waiting a certain amount of time at the end of the function passed to Queue.process
.
quque.process(
"message type",
async (job) => {
// your process here
// wait 10 seconds.
await new Promise((resolve) => { setTimeout(resolve, 10 * 1000); });
},
1
);