Skip to content

fix(receiver): ack messages that cannot be parsed or resolved - #652

Open
Sanjays2402 wants to merge 1 commit into
taskiq-python:masterfrom
Sanjays2402:fix/ack-undeliverable-messages
Open

fix(receiver): ack messages that cannot be parsed or resolved#652
Sanjays2402 wants to merge 1 commit into
taskiq-python:masterfrom
Sanjays2402:fix/ack-undeliverable-messages

Conversation

@Sanjays2402

Copy link
Copy Markdown

Closes #569

When Receiver.callback cannot parse a message, or the named task is not registered, it logged a warning and returned without acking. For ackable brokers the message was already prefetched out of the queue, so it stayed pending forever - purging the queue did not clear it, and it only reappeared when the consumer was terminated.

Both early-return paths now ack the message when it is ackable: neither an unparsable payload nor a missing task becomes processable on redelivery.

Regression tests added for both paths; they fail on master (message never acked) and pass with the fix.

When a message fails formatter parsing or names a task the broker cannot
find, the receiver logged a warning and returned without acknowledging.
For ackable brokers (e.g. RabbitMQ) the message stayed unacked and
pending forever: it was already prefetched out of the queue, so purging
the queue did not clear it and it only reappeared when the consumer was
terminated.

Both early-return paths now ack the message when it is ackable, since a
message that cannot be parsed or whose task does not exist will never
become processable by a redelivery.

Adds regression tests for both paths.

Closes taskiq-python#569
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.32%. Comparing base (ae2b788) to head (88ca8fa).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #652      +/-   ##
==========================================
+ Coverage   81.29%   81.32%   +0.02%     
==========================================
  Files          69       69              
  Lines        2577     2581       +4     
==========================================
+ Hits         2095     2099       +4     
  Misses        482      482              

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

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.

Receiver does not ack/nack Tasks that can't be found

2 participants