Skip to content

Fix #34: Return refused message to the queue and stop handling - #35

Merged
samdark merged 3 commits into
masterfrom
fix-34-refused-message
Oct 29, 2026
Merged

samdark merged 3 commits into
masterfrom
fix-34-refused-message

Conversation

@samdark

@samdark samdark commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Fixes #34.

When the handler callback returned false, for example because queue:run --limit was reached, the adapter kept the message reserved and continued with the next ones. Those messages stayed locked until ttr expired, and their attempt counters went up although they were never handled.

Now, on false, the adapter returns the message to the queue and stops:

  • The reservation is cancelled: reserved_at is cleared and the attempt counter is restored to its value before the reservation.
  • The update is guarded by the message ID and its reserved_at, so a message whose reservation already expired and was taken again is left alone.
  • No further messages are reserved.

This relies on false meaning "not processed", which yiisoft/queue#349 establishes, so it should be merged after that PR. Without it, the current QueueConsumer returns false after processing a message when the loop stops, and that message would be returned to the queue and processed again.

The package also has to work with the current yiisoft/queue first: since yiisoft/queue#321 it cannot be loaded against yiisoft/queue master, because Provider\QueueProviderInterface was removed. That is fixed in #36, which should be merged before this one.

@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.21%. Comparing base (73b7dc4) to head (86f20fd).

Additional details and impacted files
@@              Coverage Diff              @@
##             master      #35       +/-   ##
=============================================
+ Coverage     21.78%   84.21%   +62.42%     
- Complexity       30       32        +2     
=============================================
  Files             1        1               
  Lines           101      114       +13     
=============================================
+ Hits             22       96       +74     
+ Misses           79       18       -61     

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

AdapterRunTest uses an SQLite database, and the Windows PHP builds do not load pdo_sqlite by default.
@samdark
samdark merged commit aef469d into master Oct 29, 2026
28 checks passed
@samdark
samdark deleted the fix-34-refused-message branch October 29, 2026 16:01
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.

Adapter::run() keeps reserving messages after the handler returns false (queue:run --limit locks the whole queue for ttr)

1 participant