Skip to content
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

use queueMicrotask instead of setTimeout in browsers to avoid browser throttling #1761

Merged
merged 1 commit into from Aug 5, 2021

Conversation

jensengar
Copy link
Contributor

@jensengar jensengar commented Aug 2, 2021

Since setTimeout get throttled by browsers and setImmediate doesn't actually exist in any browsers, we should use queueMicrotask which works very similarly to the intention of setImmediate.

I have an app that uses stanza.io which relies on async's priorityQueue. It was found that priorityQueue is getting throttled because of its use of setTimeout(fn, 0). Most browsers support queueMicrotask, but for those who don't, we will fallback.

@djhouseknecht
Copy link

@djhouseknecht djhouseknecht commented Aug 2, 2021

For reference:

@jensengar
Copy link
Contributor Author

@jensengar jensengar commented Aug 4, 2021

@sauravazad thanks for the approval. Is there anyone else who needs to approve this? And who has merge/release rights for this?

@aearly
Copy link
Collaborator

@aearly aearly commented Aug 5, 2021

I'll merge this later today.

@aearly aearly merged commit 89255fe into caolan:master Aug 5, 2021
5 checks passed
@aearly
Copy link
Collaborator

@aearly aearly commented Aug 5, 2021

Published in v3.2.1

@jensengar
Copy link
Contributor Author

@jensengar jensengar commented Aug 9, 2021

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants