GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(receiver): harden prefetch and listener lifecycle by GefMar · Pull Request #645 · taskiq-python/taskiq

Conversation

@GefMar

@GefMar GefMar commented Jul 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Track delivery and prefetch capacity ownership across shutdown paths. Close pending listener reads, preserve late deliveries, and restore fail-fast transport error propagation.

Keep middleware accounting balanced, report discarded deliveries, and retain deferred lifecycle diagnostics when task group failures overlap.

Refs #528

im evaluated PR#630 and retained its valid requirement: the Receiver must not pull a message it cannot execute.

However, that implementation also introduces a broad retry loop that treats transport, middleware, and programming errors alike, while pending-read, iterator, late-delivery, and semaphore ownership remain implicit.

This PR instead fixes the underlying ownership invariant. Each admitted delivery explicitly owns capacity from broker read through callback completion, pending reads are cancelled and awaited, iterators are closed, and failures remain visible to the worker lifecycle owner.

Retry and backoff remain a separate policy rather than being introduced implicitly as part of the prefetch fix.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@GefMar
fix(receiver): harden prefetch and listener lifecycle
4321e09
Track delivery and prefetch capacity ownership across shutdown paths.
Close pending listener reads, preserve late deliveries, and restore
fail-fast transport error propagation.

Keep middleware accounting balanced, report discarded deliveries, and
retain deferred lifecycle diagnostics when task group failures overlap.
@GefMar
GefMar force-pushed the fix/receiver-prefetch-listener-lifecycle branch from e15d278 to 4321e09 Compare July 15, 2026 17:14
@GefMar GefMar linked an issue Jul 15, 2026 that may be closed by this pull request
max-prefetch argument doesn't work as expected #528
Closed
@codecov

codecov Bot commented Jul 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.80240% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.49%. Comparing base (ae2b788) to head (d16cee2).

Files with missing lines Patch % Lines
taskiq/receiver/receiver.py 98.78% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #645      +/-   ##
==========================================
+ Coverage   81.29%   82.49%   +1.20%     
==========================================
  Files          69       69              
  Lines        2577     2697     +120     
==========================================
+ Hits         2095     2225     +130     
+ Misses        482      472      -10     

☔ 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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@GefMar
GefMar marked this pull request as ready for review July 15, 2026 17:19
@GefMar
GefMar requested a review from s3rius July 15, 2026 17:19
@GefMar
fix(receiver): tighten prefetch ownership checks
b6f07dc
Reject invalid prefetch values before receiver retries and retain delivery accounting until execution capacity is acquired.

Add deterministic coverage for CLI defaults, cancellation races, and listener lifecycle cleanup.

Refs #528
s3rius
s3rius requested changes Jul 28, 2026
View reviewed changes
Comment thread taskiq/receiver/receiver.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread taskiq/receiver/receiver.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread taskiq/receiver/receiver.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread taskiq/receiver/receiver.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread taskiq/receiver/receiver.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread taskiq/receiver/receiver.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread taskiq/receiver/receiver.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread taskiq/receiver/receiver.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

GefMar added 2 commits August 1, 2026 18:30
@GefMar
fix(receiver): simplify prefetch listener lifecycle
a37ac15
- remove undocumented prefetch middleware hooks and metrics
- preserve listener errors during task group failures
- restore capacity when callback handoff fails
- strengthen shutdown and cleanup coverage

Refs: #528
@GefMar
refactor(receiver): simplify prefetch queue cleanup
d16cee2
@GefMar
GefMar requested a review from s3rius August 1, 2026 16:49
s3rius
s3rius approved these changes Aug 3, 2026
View reviewed changes
@GefMar
GefMar merged commit ced1909 into master Aug 15, 2026
68 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@GefMar
GefMar deleted the fix/receiver-prefetch-listener-lifecycle branch August 15, 2026 08:37
tuschla pushed a commit to tuschla/taskiq that referenced this pull request Oct 5, 2026
@GefMar
fix(receiver): harden prefetch and listener lifecycle (taskiq-python#645
21cdcb5
)

* fix(receiver): harden prefetch and listener lifecycle

Track delivery and prefetch capacity ownership across shutdown paths.
Close pending listener reads, preserve late deliveries, and restore
fail-fast transport error propagation.

Keep middleware accounting balanced, report discarded deliveries, and
retain deferred lifecycle diagnostics when task group failures overlap.

* fix(receiver): tighten prefetch ownership checks

Reject invalid prefetch values before receiver retries and retain delivery accounting until execution capacity is acquired.

Add deterministic coverage for CLI defaults, cancellation races, and listener lifecycle cleanup.

Refs taskiq-python#528

* fix(receiver): simplify prefetch listener lifecycle

- remove undocumented prefetch middleware hooks and metrics
- preserve listener errors during task group failures
- restore capacity when callback handoff fails
- strengthen shutdown and cleanup coverage

Refs: taskiq-python#528

* refactor(receiver): simplify prefetch queue cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@s3rius s3rius s3rius approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

max-prefetch argument doesn't work as expected

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@GefMar @s3rius
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.