Merge pull request #9970 from Quasilyte/quasilyte/namedConst

contrib/recipes: use clientv3.NoLease instead of 0
This commit is contained in:
Xiang Li 2018-07-29 11:37:39 -07:00 committed by GitHub
commit fa20b61c9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -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
}

View File

@ -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
}