You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, require('flexlock/createLocker') only allows a single key to lock towards lock(key, ...) but some code requires multiple resources to work, a new API that works like lock([keyA, keyB], ...) would be good. The obvious implementation would be to just use Promise.all to await three locks, but a more-complex implementation that allows other sublocks to receive early might be not a bad idea. In an example:
(B) lock(['users', 'user:12'], ...) → ... waiting for (A) to finish
(C) lock('user:12') → processing
(A) finished, (B) → waiting for (C) to finish
(C) finished, (B) → processing
(B) finished
In that example (C) can start processing without waiting for (B) to finish because it only uses part of the resources of (B). This would require a more complicated implementation though.
The text was updated successfully, but these errors were encountered:
Right now,
require('flexlock/createLocker')
only allows a single key to lock towardslock(key, ...)
but some code requires multiple resources to work, a new API that works likelock([keyA, keyB], ...)
would be good. The obvious implementation would be to just usePromise.all
to await three locks, but a more-complex implementation that allows other sublocks to receive early might be not a bad idea. In an example:lock(['users', 'user:11'], ...)
→ ... processinglock(['users', 'user:12'], ...)
→ ... waiting for (A) to finishlock('user:12')
→ processingIn that example (C) can start processing without waiting for (B) to finish because it only uses part of the resources of (B). This would require a more complicated implementation though.
The text was updated successfully, but these errors were encountered: