-
-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Helper method to emulate add(() => {}) #82
Comments
Doesn't |
When I was testing this I noticed that if I do something like this: const queue = new Queue({ concurrency: 1 });
const p1 = queue.add(() => { ... });
const p2 = queue.add(() => { ... });
const waitPromise = queue.onIdle();
const p3 = queue.add(() => { ... }); If |
You should use |
My use case requires me to add to many queues simultaneously, not that code snippet precisely. Specifically what I need is for a promise to be added to |
I have a separate hacky workaround by the way: const d = new Deferred();
const p1 = queue.add(() => { d.resolve(); ... });
const waitPromise = d.promise; |
As far as I can tell, there is no way to get a promise that resolves for all items that are currently in the queue to finish (even if new ones are added later). A hacky workaround is
const p = q.add(() => {})
which does get you this, but at the expense of adding an item to the queue.The text was updated successfully, but these errors were encountered: