Repository navigation
Conversation
…next signal A backlog that is already in the queue produces no further insert notifications, so after reading one batch the consumer slept until the poll interval elapsed: a queue of N messages took ~N/batch * pollInterval (5 s by default) to drain.
This was referenced Oct 7, 2026
Recent PHPStan 2.2.x infers the nested property assignment correctly, so the ignore is unmatched and phpstan fails on every cell of the CI matrix (8.4/8.5 x lowest/highest). (cherry picked from commit ec45573)
Contributor
Author
|
Added the one-line phpstan fix from #5 (identical change, merges in either order), so this PR is green on its own. The description now also lists the edge cases checked with a stress harness: stop in the middle of a backlog, a failing handler, concurrent producers, delayed messages, idle polling. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #2.
After reading one batch the consumer waited for the next poll signal. With a backlog no new inserts notify, so it slept
pollInterval(5 s by default) between batches: a queue ofNmessages took~N / batchSize × pollInterval.Change
PgmqTransport::startConsumer(): after a batch that came back full, push the next poll request right away. Partial or empty batches do not re-poll, so the idle query count is unchanged. A stopped consumer is respected ($polls->isComplete()).The PR also carries the one-line phpstan fix from #5 (an
@phpstan-ignorethat no longer matches). Without it the CI is red on0.5.xregardless of the change. The change is identical in both PRs, so they merge in either order.Effect (same workload and data before and after)
Edge cases checked with a stress harness (real Postgres, pgmq 1.11.1 and 1.13.0)
batchSize10,pollInterval10 spollInterval2 spollInterval1 s¹ Separate transactions inserting within the 30 ms notify throttle window can leave the last messages waiting for the timer; this happens with or without this change, see #4.
Tests
The repository has no Postgres in its dev environment, so this PR is code only. The integration tests are in #8:
consumerDrainsBacklogWithoutWaitingForPollIntervalis red on0.5.xand green with this change.Checks (run locally, PHP 8.4 / 8.5 × lowest / highest)
Tests ✅, phpstan ✅ (with the fix from #5),
fixer-check✅,rector-check✅, composer checks ✅.