Skip to content

docs: say the per-job child is built open, not unopened - #26

Merged
lesnik512 merged 1 commit into
mainfrom
docs/child-open-from-construction
Sep 19, 2026
Merged

lesnik512 merged 1 commit into
mainfrom
docs/child-open-from-construction

Conversation

@lesnik512

@lesnik512 lesnik512 commented Sep 19, 2026

Copy link
Copy Markdown
Member

setup_di's docstring said on_job_start "builds an unopened Scope.REQUEST child". The inline comment in _wrap_job_start, a few lines away, says the opposite: "modern-di already returns the child open, so open() there is a no-op re-entry". The comment is right and the docstring was wrong. This rewords the docstring; no behaviour changes.

Evidence

Checked against modern-di in the lockfile. Container.__init__ sets self.closed = False, build_child_container only constructs the child, and the class docstring says "A container is open from construction — no separate startup step is required".

The new wording says the child is built open, that @inject's reference-counted wrapper is what narrows its lifetime to the task body, and that on_job_end closes it only as a safety net. That matches _wrap_job_start, _wrap_job_end and docs/adr/0003-per-job-child-teardown-is-reference-counted.md as rewritten in #25. A repo-wide grep finds no other "unopened".

Gates

pytest -q (29 passed; Redis was reachable, so the burst-worker tests ran), ruff format --check, ruff check --no-fix. The 9 warnings are arq's own deprecated pool.close() call, python-arq/arq#418, and are unrelated.

@lesnik512
lesnik512 merged commit b1221c6 into main Sep 19, 2026
7 checks passed
@lesnik512
lesnik512 deleted the docs/child-open-from-construction branch September 19, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant