Skip to content

Commit

Permalink
stop waiting for the ready notification if the server has stopped
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Wang <[email protected]>
  • Loading branch information
ahrtr committed Oct 13, 2023
1 parent d0d0c33 commit d32e07c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/embed/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ func (sctx *serveCtx) serve(
splitHttp bool,
gopts ...grpc.ServerOption) (err error) {
logger := defaultLog.New(io.Discard, "etcdhttp", 0)
<-s.ReadyNotify()

select {
case <-s.ReadyNotify(): // wait for e.Server to join the cluster
case <-s.StopNotify(): // publish aborted from 'ErrStopped'
return nil
}

sctx.lg.Info("ready to serve client requests")

Expand Down

0 comments on commit d32e07c

Please sign in to comment.