Skip to content

Commit

Permalink
add debug log
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Aug 17, 2023
1 parent 6f4151c commit df8186d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/election/leadership.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,11 @@ func (ls *Leadership) Watch(serverCtx context.Context, revision int64) {
zap.String("purpose", ls.purpose))
return
case <-ticker.C:
log.Info("run ticker in watch loop")
if !etcdutil.IsHealthy(serverCtx, ls.client) {
// When etcd is not available, the watcher.RequestProgress will block,
// so we check the etcd availability first.
log.Warn("unhealthy in watch loop")
continue
}
log.Info("request progress in watch loop")
Expand All @@ -257,6 +259,7 @@ func (ls *Leadership) Watch(serverCtx context.Context, revision int64) {
}
cancel()
if time.Since(lastReceivedResponseTime) >= etcdutil.WatchChTimeoutDuration {
log.Info("update watchChan in watch loop")
// If no msg comes from an etcd watchChan for WatchChTimeoutDuration long,
// we should cancel the watchChan and request a new watchChan from watcher.
continue
Expand Down

0 comments on commit df8186d

Please sign in to comment.