Repository navigation
Allow finite filescan task groups to finish - #1180
Merged
Merged
Conversation
Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1177.
Separate the persistent signal listener from the user-work task group, then cancel the listener after finite work finishes. The listener no longer blocks normal context exit or prevents
run_as_mainfrom returning its result.Finite children are allowed to finish rather than being cancelled early. Signal handling stays active while they drain; explicit forever mode, callbacks and error propagation remain covered. Exceptions may be nested in task-group exception groups. This changes the task-group helper, not the scanner daemon request loop.
Testing
python -m pytest -q filescan/python-filescan/tests/test_finite_task_group.py19 focused tests passed; seven fail on unchanged main. Tests run on asyncio and Trio and cover empty/finite child groups, sequential use, callbacks, body/child/callback failures, explicit forever mode and cancellation while draining children.
The
run_as_mainreturn check and real SIGINT/SIGTERM checks run in separate Python processes with parent-enforced timeouts. Signals target only each test process itself. No scanner daemon, Redis service or external endpoint is used. Trio is an optional test backend and is skipped when not installed.89 tests passed in an isolated combined check containing these three fixes and the current #1155, #1166 and #1174 changes. That run includes the existing timezone and worker-cancellation regressions; the separate chunk-size suite was not rerun. No earlier production changes are included in this PR.
Tested on macOS with Python 3.12 and the pinned AnyIO 4.14.2. New-test formatting, scoped syntax/lint checks and
git diff --checkpass. No dependency or workflow changes. Full Malcolm deployment testing was not run.