mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #9970 from Quasilyte/quasilyte/namedConst
contrib/recipes: use clientv3.NoLease instead of 0
This commit is contained in:
commit
fa20b61c9f
@ -36,7 +36,7 @@ func NewBarrier(client *v3.Client, key string) *Barrier {
|
|||||||
|
|
||||||
// Hold creates the barrier key causing processes to block on Wait.
|
// Hold creates the barrier key causing processes to block on Wait.
|
||||||
func (b *Barrier) Hold() error {
|
func (b *Barrier) Hold() error {
|
||||||
_, err := newKey(b.client, b.key, 0)
|
_, err := newKey(b.client, b.key, v3.NoLease)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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) {
|
func newUniqueKV(kv v3.KV, prefix string, val string) (*RemoteKV, error) {
|
||||||
for {
|
for {
|
||||||
newKey := fmt.Sprintf("%s/%v", prefix, time.Now().UnixNano())
|
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 {
|
if err == nil {
|
||||||
return &RemoteKV{kv, newKey, rev, val}, nil
|
return &RemoteKV{kv, newKey, rev, val}, nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user