Skip to content

feat(pool): add EachCtx for cancellable fan-out#352

Open
TBX3D wants to merge 1 commit into
vmfunc:mainfrom
TBX3D:harden-shutdown-clean
Open

feat(pool): add EachCtx for cancellable fan-out#352
TBX3D wants to merge 1 commit into
vmfunc:mainfrom
TBX3D:harden-shutdown-clean

Conversation

@TBX3D

@TBX3D TBX3D commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Each has no way to stop early: once -max-time expires or ctrl-c fires, in-flight workers keep draining the whole queue before the pool returns. EachCtx takes a context and stops handing out new items once it's cancelled, while workers already running finish their current item rather than being killed mid-write. Each is now a thin wrapper over EachCtx with context.Background().

Each has no way to observe cancellation, so a fan-out scanner (full
port sweep, directory brute-force) keeps draining its whole queue even
after ctrl-c or -max-time fires. EachCtx takes a context and stops
feeding workers once it's cancelled, while still handing the ctx to
the callback so an in-flight item can bail out too. Each is now a thin
wrapper over EachCtx with context.Background(), so existing callers
are unaffected until they opt in.
@TBX3D
TBX3D requested a review from vmfunc as a code owner July 9, 2026 22:12
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@7ea1cd2). Learn more about missing BASE report.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #352   +/-   ##
=======================================
  Coverage        ?   54.76%           
=======================================
  Files           ?       81           
  Lines           ?     6880           
  Branches        ?        0           
=======================================
  Hits            ?     3768           
  Misses          ?     2842           
  Partials        ?      270           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot added size/m <200 lines changed tests test changes labels Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

pr summary

2 files changed (+71 -4)

category files
go source 2
tests 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m <200 lines changed tests test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants