Member
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 ๐