Skip to content

Commit

Permalink
Merge pull request #19041 from ahrtr/serve_20241211
Browse files Browse the repository at this point in the history
Do not wait for ready notify if the server is stopping
  • Loading branch information
ahrtr authored Dec 13, 2024
2 parents 2cf7172 + 93b01af commit 50e97f8
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"
defaultLog "log"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 50e97f8

Please sign in to comment.