Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions cmd/maintmode/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,12 @@ func startAPIServer(
)
s.BindRouters(cfg.Environment, meta)

// WithoutCancel: Echo shuts the server down as soon as the context passed to
// Start is canceled, and ctx is the signal context. Bound to it, the server
// would stop on SIGTERM, before the drain window lets the proxy eject this
// replica; it must keep serving until the closer calls Stop.
go func() {
if err := s.Start(ctx); err != nil {
if err := s.Start(context.WithoutCancel(ctx)); err != nil {
xlog.Fatal(ctx, "api server failed", xfield.Error(err))
}
}()
Expand Down Expand Up @@ -279,8 +283,11 @@ func startInfraServer(
xhttpserver.WithLogger(xecho.NewSlogAdapter(logger)),
)

// WithoutCancel for the same reason as the API server, and it matters most
// here: /readiness has to stay up and answer 503 for the whole drain window,
// or the proxy sees a refused connection instead of a planned drain.
go func() {
if err := s.Start(ctx); err != nil {
if err := s.Start(context.WithoutCancel(ctx)); err != nil {
xlog.Fatal(ctx, "infra server failed", xfield.Error(err))
}
}()
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/ruko1202/maintmode

go 1.26.0

toolchain go1.26.9
toolchain go1.26.10

require (
github.com/MicahParks/jwkset v0.11.4
Expand Down
Loading