Hi,
Ive been trying to use this solution in typescript and I instantiate multiple instances of the PQueue class for different job types.
After my nodejs app is run for an extended time, I notice that attempts to add to the queue do nothing.
const { default: PQueue } = require("p-queue");
const queue1 = new PQueue({ concurrency: 1 });
const queue2 = new PQueue({ concurrency: 3 });
public async queueComment(comment) {
log.debug(`${comment.sender} queuing incoming comment...`);
queue1.add(() => this.processComment(comment), this);
}
public async queueMessage(message) {
log.debug(`${message.sender} queuing incoming message...`);
queue2.add(() => this.processMessage(message), this);
}
The queues are defined within a typescript class which is then instantiated and used to call the public functions to queue the comment and message received. After long running, the processComment and processMessage methods stopped getting called.
I'm wondering if something is causing the queue to stop, or if I can declare multiple queues in the same file or doing something else wrong thats causing this issue.
Note that I also subscribe to the 'active' event which logs the size and pending in the queue, which also stops logging. It just seems the add() method on the queue just doesnt work anymore unless I restart. Note that this is also being run in a docker container.
Any directions are much appreciated as I rather not try to write my own handling of this logic
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too