How to stop a queue in NestJs, perform an action and then resume that same queue

Issue

I’m trying to make the queue of file upload and I’m having a problem, I need to upload the file to s3 bucket in the async function into the queue, but, my queue finalize before the upload file are completed. As can be seeing in the image, the consoles indicates step by step of my queue and the "job completed" appear before of "File upload!", how can I fix it?

queue image at file upload time

Solution

Firstly, it is not possible to use async/await with forEach and as a new array is not needed, it would not be the best option to use the map, instead, choose to use for..of.

Your problem is apparently being caused by you doing data processing in a consumer utility hook, try using another process for this task.

Answered By – Alessandro Rodrigo

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published