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

Race conditions #10

Open
JeanHuguesRobert opened this issue Nov 26, 2012 · 1 comment
Open

Race conditions #10

JeanHuguesRobert opened this issue Nov 26, 2012 · 1 comment

Comments

@JeanHuguesRobert
Copy link

Due to the fact that it is preferred to have callbacks called asynchronously, there is a delay between when a promise is resolved/rejected and when the callbacks are called. If during that delay .then is called, depending on the implementation, the newly added callbacks could very well be called twice: once by the delayed handler and once by the code that, in .then(), detects that the promise is already done.

A test to check against that would basically use .then(), .resolve() and .then() again, making sure that two callbacks are called only, in the proper order.

This is slightly pedandic, but I ran into that bug when implementing promises in my multitasker and other may have the same issue with this corner case. See https://github.com/JeanHuguesRobert/l8

@domenic
Copy link
Owner

domenic commented Nov 26, 2012

Yep, noted a similar issue over in promises-aplus/promises-tests#6.

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

No branches or pull requests

2 participants