Skip to content

fix: take a consumer handler slot before receiving - #1166

Merged
alexluong merged 2 commits into
mainfrom
fix/consumer-slot-before-receive
Oct 28, 2026
Merged

alexluong merged 2 commits into
mainfrom
fix/consumer-slot-before-receive

Conversation

@alexluong

@alexluong alexluong commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Take the handler slot before receiving, so the consumer only holds a message it can run now.

The consumer received the next message and then waited for a free handler slot. With every handler busy, that message waited for a handler to finish while its visibility timeout ran. If the consumer shut down during the wait, the message was dropped without an ack or nack and came back only after the timeout.

It is one message per consumer: the broker SDKs prefetch, so the rest of the backlog waits in the SDK either way. GCP Pub/Sub manages its own concurrency and doesn't use this path.

TestConsumer_ReceivesOnlyWithFreeSlot fails on the old code: with both slots busy, the consumer received a third message.

🤖 Generated with Claude Code

alexluong and others added 2 commits October 25, 2026 00:18
@alexluong
alexluong merged commit 46d52c8 into main Oct 28, 2026
2 checks passed
@alexluong
alexluong deleted the fix/consumer-slot-before-receive branch October 28, 2026 04:02
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.

2 participants