5 ms·
If R2 returns before R1 that is still a race condition, but it might not be a bug.
by throwaway2048 6y ago
If R2 returns before R1 that is still a race condition, but it might not be a bug.
- MaxBarraclough 6y ago> If R2 returns before R1 that is still a race condition That's not correct. Look at chrisseaton's definition. If the observable program behaviour doesn't change depending on the order in which the requests complete, there's no race condition. (In JavaScript this might be done with Promise.all.) You're right that not all race conditions are bugs.
- gildas 6y agoThere is even Promise.race provided for that purpose in JavaScript. You can typically use it to implement a watchdog.