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 committed Dec 12, 2024
1 parent 9e1c24c commit 589769c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion 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 @@ -100,7 +101,12 @@ func (sctx *serveCtx) serve(
gopts ...grpc.ServerOption,
) (err error) {
logger := defaultLog.New(io.Discard, "etcdhttp", 0)
<-s.ReadyNotify()

select {
case <-s.StoppingNotify():
return errors.New("server is stopping")

Check warning on line 107 in server/embed/serve.go

View check run for this annotation

Codecov / codecov/patch

server/embed/serve.go#L106-L107

Added lines #L106 - L107 were not covered by tests
case <-s.ReadyNotify():
}

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

Expand Down

0 comments on commit 589769c

Please sign in to comment.