Skip to content

Commit

Permalink
Merge pull request #13410 from smartcontractkit/overtime-query-logs
Browse files Browse the repository at this point in the history
core/services/pipeline: hide deadline from monitor
  • Loading branch information
snehaagni authored Jun 5, 2024
2 parents d202837 + 2cf506b commit 4f1cb37
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions core/services/pipeline/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,16 @@ func init() {
// results, even after context cancellation.
func overtimeContext(ctx context.Context) (context.Context, context.CancelFunc) {
if d, ok := ctx.Deadline(); ok {
// extend deadline
return context.WithDeadline(context.WithoutCancel(ctx), d.Add(overtime))
}
// remove cancellation
// We do not use context.WithDeadline/Timeout in order to prevent the monitor hook from logging noisily, since
// we expect and want these operations to use most of their allotted time.
// TODO replace with custom thresholds: https://smartcontract-it.atlassian.net/browse/BCF-3252
var cancel context.CancelFunc
ctx, cancel = context.WithCancel(context.WithoutCancel(ctx))
t := time.AfterFunc(time.Until(d.Add(overtime)), cancel)
stop := context.AfterFunc(ctx, func() { t.Stop() })
return ctx, func() { cancel(); stop() }
}
// do not propagate cancellation in any case
return context.WithoutCancel(ctx), func() {}
}

Expand Down

0 comments on commit 4f1cb37

Please sign in to comment.