Duplicate subqueue registration makes messages unreachable
- Dominant language
- Scala
- Stars
- 314
- Forks
- 187
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 214
Description
### Feature Summary
The queue replaces the key lookup when the same subqueue is registered twice, but its priority group still contains the original queue. New messages then increase the total count while becoming unreachable to consumers.
Before: duplicate key -> lookup points to an orphan queue -> total count includes an unreachable message
After: duplicate key -> existing queue is preserved -> all messages remain selectable
Expected behavior:
Registering an existing key should preserve and return the registered queue so previously and subsequently enqueued messages remain reachable.
Reproduction evidence:
On current `main`, register a subqueue, enqueue one message, register the same key again, and enqueue a second message. The first message can be read, but `peek()` then returns `None` while the reported total size remains 1.
Observed on `70c21145887920528d7d5540e3fb790b43e8b759`:
```text
first_registration=None
duplicate_returned_old=True
reported_total=2
reported_key=1
first_get=first
after_first_total=1
peek_after_first=None
```
Version and commit evidence:
1.3.0-incubating-SNAPSHOT (main)
**Commit Hash (Optional)**
`70c21145887920528d7d5540e3fb790b43e8b759`
### Proposed Solution or Design
After: duplicate key -> existing queue is preserved -> all messages remain selectable
Expected behavior:
### Affected Area
Workflow Engine (Amber)
Contributor guide
Assessment
This issue has not been assessed yet.