mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-29 10:21:01 -06:00
Remove 'lockSuffix' as not needed in 'etcd' v3.
This commit is contained in:
parent
bb4dec6032
commit
038f5eb638
@ -18,7 +18,6 @@ import (
|
||||
const (
|
||||
lockAcquireTimeout = 2 * time.Second
|
||||
lockInfoSuffix = ".lockinfo"
|
||||
lockSuffix = ".lock"
|
||||
)
|
||||
|
||||
// RemoteClient is a remote client that will store data in etcd.
|
||||
@ -165,7 +164,7 @@ func (c *RemoteClient) lock() (string, error) {
|
||||
ctx, cancel := context.WithTimeout(context.TODO(), lockAcquireTimeout)
|
||||
defer cancel()
|
||||
|
||||
mutex := etcdv3sync.NewMutex(session, c.Key+lockSuffix)
|
||||
mutex := etcdv3sync.NewMutex(session, c.Key)
|
||||
if err1 := mutex.Lock(ctx); err1 != nil {
|
||||
lockInfo, err2 := c.getLockInfo()
|
||||
if err2 != nil {
|
||||
|
@ -83,13 +83,11 @@ func TestEtcdv3_destroyLock(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
lockPath := c.Key + lockSuffix
|
||||
|
||||
if err := c.Unlock(id); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
res, err := c.Client.KV.Get(context.TODO(), lockPath)
|
||||
res, err := c.Client.KV.Get(context.TODO(), c.Key)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user