Replace context.TODO() with the current component's context#488
Replace context.TODO() with the current component's context#488NGTmeaty merged 1 commit intointernetarchive:mainfrom
Conversation
Note that we leave `context.TODO()` in `internal/pkg/source/hq/consumer.go` because its a special case.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #488 +/- ##
=======================================
Coverage 56.29% 56.29%
=======================================
Files 130 130
Lines 8109 8109
=======================================
Hits 4565 4565
Misses 3177 3177
Partials 367 367
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR replaces instances of context.TODO() with appropriate context objects to improve context propagation and cancellation handling across the Zeno web crawler's source components. This change ensures that operations can be properly cancelled and traced through their execution context.
Key changes:
- Replace
context.TODO()with component context (s.ctx) for client operations - Use function parameter context (
ctx) where available for better scope alignment - Remove unused
contextimport where no longer needed
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/pkg/source/lq/lq.go | Replace context.TODO() with s.ctx in resetURL call |
| internal/pkg/source/lq/finisher.go | Replace context.TODO() with ctx parameter in delete operation |
| internal/pkg/source/lq/consumer.go | Replace context.TODO() with s.ctx in getURLs and fix context usage |
| internal/pkg/source/hq/seencheck.go | Replace context.TODO() with s.ctx in Seencheck call and remove unused import |
| internal/pkg/source/hq/producer.go | Replace context.TODO() with ctx parameter in Add operation |
| internal/pkg/source/hq/hq.go | Replace context.TODO() with s.ctx in ResetURL call |
| internal/pkg/source/hq/finisher.go | Replace context.TODO() with ctx parameter in Delete operation |
| internal/pkg/source/hq/consumer.go | Replace context.TODO() with s.ctx in Get and errgroup operations |
NGTmeaty
left a comment
There was a problem hiding this comment.
Looks good! Thank you!
Note that we leave
context.TODO()ininternal/pkg/source/hq/consumer.gobecause its a special case.Fixing issue: #472