Closed samjross closed 4 years ago
Yes, they will acquire the lock in order. However there are no tests for this behavior and I wouldn't consider it part of the API.
If you rely on multiple tasks happening in a precise order for a reason other than fair scheduling and avoiding starvation, that means there's a dependency between your tasks that is easier to see if it's explicit in the code rather than implicit in this library's queue state.
This isn't an issue so much as a question, but I don't see another place to ask a question and I don't see an answer to this in the documentation.
If I have my lock object,
const lock = new AwaitLock();
, and I'm callingawait lock.acquireAsync();
in various places in the code, will those promises that I get back from.acquireAsync()
always resolve in the same order I called them?