You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that the queue actually waits for the job to end to start the new one but there is a difference on when the callback is called in terms of async logic: https://stackblitz.com/edit/node-1fslka?file=index.js
I'm not sure this is an actual issue? There will always be subtle differences in timing with using callbacks vs functions. If you need to the task callback to not block the event loop, you can always defer inside it.
What version of async are you using?
3.2.4
Which environment did the issue occur in (Node/browser/Babel/Typescript version)
Node
What did you do? Please include a minimal reproducible case illustrating issue.
Using async.queue I get different execution results when I use promises instead of callbacks.
https://stackblitz.com/edit/node-qeye7d?file=index.js
You can execute the code in this example by typing
node index
in the stackblitz terminal.What did you expect to happen?
Results should be the same.
What was the actual result?
Results were different in terms of order of execution.
Here's my code:
Actual output is:
CALLBACKS
job started job1
job done { name: 'job1' }
job started job2
job done { name: 'job2' }
PROMISES
job started job1
job started job2
job done { name: 'job1' }
job done { name: 'job2' }
Expected output is:
CALLBACKS
job started job1
job done { name: 'job1' }
job started job2
job done { name: 'job2' }
PROMISES
job started job1
job done { name: 'job1' }
job started job2
job done { name: 'job2' }
The text was updated successfully, but these errors were encountered: