- build: update Go from 1.20 to 1.22
- build(deps): various updates
- Various dependencies updates
- chore(go): use go 1.17
- Bump go.etcd.io/etcd/client/v3 from 3.5.0 to 3.5.4
- Bump github.com/stretchr/testify from 1.7.0 to 1.8.0
- Bump github.com/golang/mock from 1.4.4 to 1.6.0
- Bump go.etcd.io/etcd/client from 3.3.0 to 3.5.0 (with Go modules support! \o/)
- Bump github.com/golang/mock from 1.4.3 to 1.4.4 #12
- Bump github.com/stretchr/testify from 1.4.0 to 1.7.0 #13
- Use v5 version in test files
- Package is now github.com/Scalingo/go-etcd-lock/v5 conforming to go modules semantic
- Clean Go modules dependencies
- Checkin go.mod
- Fix error management
- Fix connection leak to ETCD (
clientv3/concurrency.Session
was never closed)
- More go-ish API
lock.Error
-> lock.ErrAlreadyLocked
lock.WithTrylockTimeout
-> lock.WithTryLockTimeout
- Better configurability in
lock.NewEtcdLocker()
lock.WithMaxTryLockTimeout
: Set a max duration a caller can wait for a lock in WaitAcquire
(default: 2 minutes)
lock.WithCooldownTryLockDuration
: Set a duration between calls to ETCD to acquire a lock (default: 1 second)
- Prevent
clientv3/concurrency.Mutex.Lock(ctx)
to be called with an infinite context.Background()
which was basically blocking forever.
- Simpler dependencies management
- Fix race condition in specs
func Wait(client *etcd.Client, key string) error
func WaitAcquire(client *etcd.Client, key string, uint64 ttl) (*Lock, erro)
func Acquire(client *etcd.Client, key string, uint64 ttl) (*Lock, error)
func (lock *Lock) Release() error