Skip to content

Commit

Permalink
Do not wait for ready notify if the server is stopping
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Wang <[email protected]>
  • Loading branch information
ahrtr authored and k8s-infra-cherrypick-robot committed Dec 13, 2024
1 parent 762e938 commit db06504
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions server/embed/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package embed

import (
"context"
"errors"
"fmt"
"io/ioutil"
defaultLog "log"
Expand Down Expand Up @@ -100,6 +101,12 @@ func (sctx *serveCtx) serve(
logger := defaultLog.New(ioutil.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)
Expand Down

0 comments on commit db06504

Please sign in to comment.