Revert "[chore] Remove parent setting / getting in Context wrapper (#1516)" (#1519)

This reverts commit 8ec5e4916c.
This commit is somehow causing AWS verification (and possibly others) to
not work.
This commit is contained in:
Miccah 2023-07-20 23:31:28 -05:00 committed by GitHub
parent 8ec5e4916c
commit e8b5e3cea3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View file

@ -18,11 +18,22 @@ var (
type Context interface {
context.Context
Logger() logr.Logger
Parent() context.Context
SetParent(ctx context.Context) Context
}
// CancelFunc is a type alias to context.CancelFunc to allow use as if they are
// the same types.
type CancelFunc = context.CancelFunc
// Parent returns the parent context.
func (l logCtx) Parent() context.Context {
return l.Context
}
// SetParent sets the parent context on the context.
func (l logCtx) SetParent(ctx context.Context) Context {
l.Context = ctx
return l
}
type CancelFunc context.CancelFunc
// logCtx implements Context.
type logCtx struct {

View file

@ -130,7 +130,7 @@ func Start(ctx context.Context, options ...EngineOption) *Engine {
sourcesWg, egCtx := errgroup.WithContext(ctx)
sourcesWg.SetLimit(e.concurrency)
e.sourcesWg = sourcesWg
ctx = context.WithLogger(egCtx, ctx.Logger())
ctx.SetParent(egCtx)
if len(e.decoders) == 0 {
e.decoders = decoders.DefaultDecoders()