finish handleDelayedTask
parent
3b550dd8e5
commit
73ffb245d5
|
@ -53,8 +53,8 @@ func (d *deliver) assign(key string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
cmp := clientv3.Compare(clientv3.ModRevision(assignKey), "=", "0")
|
cmp := clientv3.Compare(clientv3.CreateRevision(assignKey), "=", 0)
|
||||||
putReq := clientv3.OpPut(assignKey, "node", clientv3.WithLease(grantResp.ID), clientv3.WithCreatedNotify())
|
putReq := clientv3.OpPut(assignKey, "node", clientv3.WithLease(grantResp.ID))
|
||||||
getReq := clientv3.OpGet(key)
|
getReq := clientv3.OpGet(key)
|
||||||
resp, err := d.client.Txn(ctx).If(cmp).Then(putReq, getReq).Commit()
|
resp, err := d.client.Txn(ctx).If(cmp).Then(putReq, getReq).Commit()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue