contrib/recipes: use clientv3.NoLease instead of 0

If we have a named const, it's more readable to use that.

Found using https://go-critic.github.io/overview#namedConst-ref
This commit is contained in:
Iskander Sharipov 2018-07-28 23:56:45 +03:00
parent 90a2fbe50e
commit 1de9e1b00d
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
}