werf / lockgate

Lockgate is a cross-platform distributed locking library for Go. Supports distributed locks backed by Kubernetes or HTTP lock server. Supports conventional OS file locks.
Apache License 2.0
256 stars 15 forks source link

Acquirer Queue #42

Closed cwarden closed 5 months ago

cwarden commented 5 months ago

Add optional AcquirerId to AcquireOptions. If passed, it will hold the acquirer's place in line if the requested lock is already held.

When the lock expires or is released, the next acquirer will be the one that has been waiting the longest.

distorhead commented 5 months ago

@cwarden Hi! Code looks clever, thanks for sharing. Giving you an approve for merge.

Can I ask you to add a sample of AcquirerID usage case and what benefits it brings to the user into the README.md (in a separate PR)?

cwarden commented 5 months ago

@cwarden Hi! Code looks clever, thanks for sharing. Giving you an approve for merge.

Can I ask you to add a sample of AcquirerID usage case and what benefits it brings to the user into the README.md (in a separate PR)?

I opened #43 with an update to the README. Feel free to edit.

shurup commented 5 months ago

Thank you very much for this contribution, @cwarden! :pray:

P.S. Just wanted to link here your related discussion as well so that the implementation history will be more full: #41