server: prevent blocking

This commit is contained in:
nolouch 2018-09-14 16:07:12 +08:00
parent 4de27039cb
commit f3f6427586
2 changed files with 5 additions and 1 deletions

View File

@ -1790,6 +1790,7 @@ func TestLeasingTxnOwnerPutBranch(t *testing.T) {
defer testutil.AfterTest(t)
clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 3})
defer clus.Terminate(t)
lkv, closeLKV, err := leasing.NewKV(clus.Client(0), "foo/")
testutil.AssertNil(t, err)
defer closeLKV()

View File

@ -942,7 +942,10 @@ func (s *EtcdServer) run() {
}
}
if newLeader {
s.leaderChanged <- struct{}{}
select {
case s.leaderChanged <- struct{}{}:
default:
}
}
// TODO: remove the nil checking
// current test utility does not provide the stats