Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix awaiting queued handlers when cancelling a queued handler #313

Merged
merged 1 commit into from
Mar 27, 2018

Conversation

clue
Copy link
Member

@clue clue commented Mar 26, 2018

This PR fixes a subtle bug that can be triggered by cancelling a queued middleware request handler, i.e. before it is actually started (pending). If too many handlers are already pending, cancelling one of the queued handlers should not invoke another handler. On the other hand, cancelling a pending handler should invoke the next queued handler.

This is a subtle situation that is explicitly covered by the new tests added (see last test case). The remaining test cases exist to ensure we do not introduce any regressions and this stays at 100% coverage.

I noticed this while implementing https://github.com/clue/php-mq-react and basically backported the same logic to this project 👍

@clue clue added the bug label Mar 26, 2018
@clue clue added this to the v0.8.2 milestone Mar 26, 2018
@jsor jsor merged commit 327bdfe into reactphp:master Mar 27, 2018
@clue clue deleted the queued-cancellation branch March 27, 2018 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants