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

Function sometimes run synchronously, sometimes asynchronously #22

Closed
dcporter opened this issue Feb 19, 2020 · 3 comments · Fixed by #28
Closed

Function sometimes run synchronously, sometimes asynchronously #22

dcporter opened this issue Feb 19, 2020 · 3 comments · Fixed by #28

Comments

@dcporter
Copy link

If you pass in a function to a Limit, if there's space in the queue it runs the function synchronously. If there isn't, of course it runs later. This makes the performance characteristics of enqueuing unpredictable, and results in state sometimes changing before the next line of code, and sometimes not. (My team affectionately refers to the set of subtle bugs that this "sometimes-sync-sometimes-async" behavior can call as "zalgo".) It would be nice if enquing always deferred the enqueued function at least until the next tick.

@sindresorhus
Copy link
Owner

This is a bug and not intended behavior.

@qhxin
Copy link

qhxin commented Mar 12, 2020

yes, and, it may cause the queue not be finished.

@sjgmojica
Copy link

sjgmojica commented Apr 16, 2020

This issue Is solve? Thanks

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

Successfully merging a pull request may close this issue.

4 participants