Browse Source

Merge pull request #9970 from Quasilyte/quasilyte/namedConst

contrib/recipes: use clientv3.NoLease instead of 0
Xiang Li 7 years ago
parent
commit
fa20b61c9f
2 changed files with 2 additions and 2 deletions
  1. 1 1
      contrib/recipes/barrier.go
  2. 1 1
      contrib/recipes/key.go

+ 1 - 1
contrib/recipes/barrier.go

@@ -36,7 +36,7 @@ func NewBarrier(client *v3.Client, key string) *Barrier {
 
 // Hold creates the barrier key causing processes to block on Wait.
 func (b *Barrier) Hold() error {
-	_, err := newKey(b.client, b.key, 0)
+	_, err := newKey(b.client, b.key, v3.NoLease)
 	return err
 }
 

+ 1 - 1
contrib/recipes/key.go

@@ -47,7 +47,7 @@ func newKV(kv v3.KV, key, val string, leaseID v3.LeaseID) (*RemoteKV, error) {
 func newUniqueKV(kv v3.KV, prefix string, val string) (*RemoteKV, error) {
 	for {
 		newKey := fmt.Sprintf("%s/%v", prefix, time.Now().UnixNano())
-		rev, err := putNewKV(kv, newKey, val, 0)
+		rev, err := putNewKV(kv, newKey, val, v3.NoLease)
 		if err == nil {
 			return &RemoteKV{kv, newKey, rev, val}, nil
 		}