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

Add HoldLease Function #44

Closed cwarden closed 4 months ago

cwarden commented 5 months ago

Add a HoldLease function that can be used to renew a lease acquired from a separate process.

This is useful when you want to block while waiting for a lease, then renew the lease in the background, e.g.

$ export LOCK=$(deploylock-client acquire -n lock-name https://lock-server/)
$ deploylock-client renew -n lock-name -l $LOCK https://lock-server/ &
$ <do work while holding lease>
alexey-igrychev commented 4 months ago

Thank you for your contribution ❤️