Do not wait for ready notify if the server is stopping
Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com>
This commit is contained in:
@ -16,6 +16,7 @@ package embed
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
defaultLog "log"
|
||||
@ -102,6 +103,12 @@ func (sctx *serveCtx) serve(
|
||||
logger := defaultLog.New(io.Discard, "etcdhttp", 0)
|
||||
<-s.ReadyNotify()
|
||||
|
||||
select {
|
||||
case <-s.StoppingNotify():
|
||||
return errors.New("server is stopping")
|
||||
case <-s.ReadyNotify():
|
||||
}
|
||||
|
||||
sctx.lg.Info("ready to serve client requests")
|
||||
|
||||
m := cmux.New(sctx.l)
|
||||
|
Reference in New Issue
Block a user