core: use context.WithoutCancel (#4959)

This commit is contained in:
Caleb Doxsey 2024-02-09 13:55:06 -07:00 committed by GitHub
parent 6b245d2a24
commit 76862c2fe8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1 additions and 25 deletions

View file

@ -7,8 +7,6 @@ import (
"net"
"net/http"
"time"
"github.com/pomerium/pomerium/pkg/contextutil"
)
// ServeWithGracefulStop serves the HTTP listener until ctx.Done(), and then gracefully stops and waits for gracefulTimeout
@ -17,7 +15,7 @@ func ServeWithGracefulStop(ctx context.Context, handler http.Handler, li net.Lis
// create a context that will be used for the http requests
// it will only be cancelled when baseCancel is called but will
// preserve the values from ctx
baseCtx, baseCancel := context.WithCancelCause(contextutil.OnlyValues(ctx))
baseCtx, baseCancel := context.WithCancelCause(context.WithoutCancel(ctx))
srv := http.Server{
Handler: handler,