Browse Source

fix health check bug, fix #1367

fatedier 5 years ago
parent
commit
757b3613fe
1 changed files with 3 additions and 3 deletions
  1. 3 3
      client/health/health.go

+ 3 - 3
client/health/health.go

@@ -96,12 +96,12 @@ func (monitor *HealthCheckMonitor) Stop() {
 
 func (monitor *HealthCheckMonitor) checkWorker() {
 	for {
-		ctx, cancel := context.WithDeadline(monitor.ctx, time.Now().Add(monitor.timeout))
-		err := monitor.doCheck(ctx)
+		doCtx, cancel := context.WithDeadline(monitor.ctx, time.Now().Add(monitor.timeout))
+		err := monitor.doCheck(doCtx)
 
 		// check if this monitor has been closed
 		select {
-		case <-ctx.Done():
+		case <-monitor.ctx.Done():
 			cancel()
 			return
 		default: