Skip to content

Commit

Permalink
chore(deregister): tweak order the of deregister
Browse files Browse the repository at this point in the history
  • Loading branch information
whalecold committed Nov 17, 2023
1 parent f572399 commit 8b07d34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions client/circuit_breaker.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ func WithCircuitBreaker(dest, src string, nacosClient nacos.Client, opts utils.O
return []client.Option{
client.WithCircuitBreaker(cbSuite),
client.WithCloseCallbacks(func() error {
err := cbSuite.Close()
err := nacosClient.DeregisterConfig(param, uniqueID)
if err != nil {
return err
}
// cancel the configuration listener when client is closed.
return nacosClient.DeregisterConfig(param, uniqueID)
return cbSuite.Close()
}),
}
}
Expand Down
6 changes: 5 additions & 1 deletion client/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ func WithRetryPolicy(dest, src string, nacosClient nacos.Client, opts utils.Opti
client.WithCloseCallbacks(rc.Close),
client.WithCloseCallbacks(func() error {
// cancel the configuration listener when client is closed.
return nacosClient.DeregisterConfig(param, uniqueID)
err := nacosClient.DeregisterConfig(param, uniqueID)
if err != nil {
return err
}
return rc.Close()
}),
}
}
Expand Down

0 comments on commit 8b07d34

Please sign in to comment.