Browse Source

Merge pull request #4094 from heyitsanthony/send-merged-done-nowait

etcdserver: respect done channel when sleeping for snapshot backoff
Anthony Romano 10 years ago
parent
commit
8346a7c052
1 changed files with 4 additions and 1 deletions
  1. 4 1
      etcdserver/server.go

+ 4 - 1
etcdserver/server.go

@@ -933,7 +933,10 @@ func (s *EtcdServer) sendMergedSnap(merged snap.Message) {
 			// If the follower still fails to catch up, it is probably just too slow
 			// If the follower still fails to catch up, it is probably just too slow
 			// to catch up. We cannot avoid the snapshot cycle anyway.
 			// to catch up. We cannot avoid the snapshot cycle anyway.
 			if ok {
 			if ok {
-				time.Sleep(releaseDelayAfterSnapshot)
+				select {
+				case <-time.After(releaseDelayAfterSnapshot):
+				case <-s.done:
+				}
 			}
 			}
 			atomic.AddInt64(&s.inflightSnapshots, -1)
 			atomic.AddInt64(&s.inflightSnapshots, -1)
 		case <-s.done:
 		case <-s.done: