core: fix graceful stop (#4866)

core: fix graceful stop (#4865)

* core/grpc: fix graceful stop

* core/http: add graceful stop serve

Co-authored-by: Caleb Doxsey <cdoxsey@pomerium.com>
This commit is contained in:
backport-actions-token[bot] 2023-12-29 10:24:21 -07:00 committed by GitHub
parent 33b4662187
commit 15ebb4dba2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 311 additions and 48 deletions

View file

@ -64,3 +64,25 @@ func (mc *mergedCtx) Value(key interface{}) interface{} {
}
return mc.doneCtx.Value(key)
}
type onlyValues struct {
context.Context
}
// OnlyValues returns a derived context that removes deadlines and cancellation,
// but keeps values.
func OnlyValues(ctx context.Context) context.Context {
return onlyValues{ctx}
}
func (o onlyValues) Deadline() (time.Time, bool) {
return time.Time{}, false
}
func (o onlyValues) Done() <-chan struct{} {
return nil
}
func (o onlyValues) Err() error {
return nil
}