Skip to content

Commit

Permalink
新增:flog.ErrorIfExists方法
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Jul 13, 2023
1 parent cf8e5c9 commit 0446409
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,7 @@ func (receiver *client) LeaseGrant(ttl int64, keys ...string) (LeaseID, error) {
}
if len(rsp.Kvs) > 0 {
_, err = receiver.etcdCli.Put(todo, key, string(rsp.Kvs[0].Value), etcdV3.WithLease(leaseGrantResponse.ID))
if err != nil {
_ = flog.Error(err)
}
flog.ErrorIfExists(err)

Check failure on line 192 in client.go

View workflow job for this annotation

GitHub Actions / build

undefined: flog.ErrorIfExists
}
}
}
Expand All @@ -201,8 +199,7 @@ func (receiver *client) LeaseGrant(ttl int64, keys ...string) (LeaseID, error) {
func (receiver *client) LeaseKeepAlive(ctx context.Context, leaseId LeaseID) error {
keepRespChan, err := receiver.etcdCli.KeepAlive(ctx, etcdV3.LeaseID(leaseId))
if err != nil {
_ = flog.Error(err)
return err
return flog.Error(err)
}

// 自动续租
Expand All @@ -226,9 +223,7 @@ func (receiver *client) LeaseKeepAlive(ctx context.Context, leaseId LeaseID) err

func (receiver *client) LeaseKeepAliveOnce(leaseId LeaseID) error {
_, err := receiver.etcdCli.KeepAliveOnce(todo, etcdV3.LeaseID(leaseId))
if err != nil {
_ = flog.Error(err)
}
flog.ErrorIfExists(err)

Check failure on line 226 in client.go

View workflow job for this annotation

GitHub Actions / build

undefined: flog.ErrorIfExists
return err
}

Expand Down

0 comments on commit 0446409

Please sign in to comment.