Skip to content
Snippets Groups Projects
Commit fb04876b authored by 382673304@qq.com's avatar 382673304@qq.com
Browse files

fix: change ticker to after

parent 44d2947e
No related branches found
No related tags found
No related merge requests found
......@@ -194,7 +194,7 @@ func (r *consulRegistry) IsAvailable() bool {
func (r *consulRegistry) Destroy() {
if r.URL != nil {
done := make(chan struct{}, 1)
ticker := time.NewTicker(r.timeOut)
ticker := time.After(r.timeOut)
go func() {
defer func() {
if e := recover(); e != nil {
......@@ -209,9 +209,8 @@ func (r *consulRegistry) Destroy() {
select {
case <-done:
logger.Infof("consulRegistry unregister done")
case <-ticker.C:
case <-ticker:
logger.Errorf("consul unregister timeout")
ticker.Stop()
}
}
close(r.done)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment