mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(sqs): delayed FIFO message no longer blocks its message group (#2112)
Only in-flight messages (claimed, within their visibility timeout) lock a FIFO message group. claimFifo() used !isVisible() as the lock predicate, which also matches messages still waiting out DelaySeconds, so a newly sent delayed message made already-visible messages in its group unreceivable. Require a receipt handle as well, the same delayed-vs-in-flight discriminator messageCounts() already uses. Fixes #2104
This commit is contained in:
1 parent
cd3c6b54b2
commit
fa8f8d78a4
4 files changed
+112
-2
No files matched your search
@@ -120,9 +120,13 @@ class GuardedMessageQueue {
|
||||
// message from a previous ReceiveMessage call is blocked until that
|
||||
// message is deleted or its visibility expires. Within a single call
|
||||
// we may return multiple messages from the same group (preserving
|
||||
// insertion order), up to MaxNumberOfMessages.
|
||||
// insertion order), up to MaxNumberOfMessages. A not-visible message
|
||||
// that was never claimed — no receipt handle — is only waiting out its
|
||||
// DelaySeconds and must not lock its group.
|
||||
Set<String> groupsWithInFlight =
|
||||
messages.stream().filter(msg -> !msg.isVisible() && msg.getMessageGroupId() != null)
|
||||
messages.stream()
|
||||
.filter(msg -> !msg.isVisible() && msg.getReceiptHandle() != null
|
||||
&& msg.getMessageGroupId() != null)
|
||||
.map(Message::getMessageGroupId).collect(Collectors.toSet());
|
||||
|
||||
for (Message msg : messages) {
|
||||
|
||||
Reference in new issue
Block a user