10 months ago
I have a NestJS application that uses “@nestjs/bull” queues. The problem is that no new items are added to the queue.
For example, if I call the add method from some part of my application, no item is added to the queue:
”
this.queueService.add(...);
// at this moment the application continues working, but no item is added to the queue
...
add(action: string, data: any): void {
this.queue.add(action, data);
}
”, but if I add async before my add method, and await before this.queue.add await, that code will take forever to execute:
”
await this.queueService.add(...);
// at which point the application hangs
...
async add(action: string, data: any): Promise<void> {
await this.queue.add(action, data);
}
”
As far as I understand, bull uses wokers to handle tasks in separate processes. And Railway, in turn, does not allow the creation of these processes.
If I am right, is there any solution to this problem? If not, please tell me what the problem is, because in the local environment everything works correctly.
I use a free plan. I have Redis and my NestJS application deployed within my Railway environment.
3 Replies
10 months ago
How are you creating these separate processes?
On Railway, we recommend you run each process inside of a service, so that they can scale indepedantly
Status changed to Awaiting User Response Railway • 10 months ago
10 months ago
How are you creating these separate processes?
On Railway, we recommend you run each process inside of a service, so that they can scale indepedantly
Indeed, every process runs inside the service, but I still can't solve the problem described above. I can't add a new item to the queue: when using await, the application just hangs, and without it the item is simply not added. I tested locally, where the code worked correctly. So I assumed that maybe I have misconfigured something on Railway, and because of that the code can't be executed correctly.
I am using the following libraries:
"dependencies": {
"@nestjs/bull": "^10.2.0",
Status changed to Awaiting Railway Response Railway • 10 months ago
10 months ago
Unfortunately not familiar with the library and this does indeed look like an application level issue. I'll open it up to the wider community and maybe they can help.
Status changed to Awaiting User Response Railway • 10 months ago
10 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open jake • 10 months ago