Peeking a queue changes its next message
- Dominant language
- Scala
- Stars
- 314
- Forks
- 187
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 214
Description
### Feature Summary
`PriorityGroup.peek()` advances the shared round-robin cursor while skipping empty subqueues. A read-only peek can therefore change which message a later `get()` returns.
Before: peek skips an empty queue -> shared cursor advances -> later get returns a different queue
After: peek scans with a local cursor -> shared cursor stays unchanged -> later get preserves round-robin order
Expected behavior:
Peeking should report the next available message without changing queue selection state or the order of a later get.
Reproduction evidence:
Create two same-priority subqueues, enqueue only in the second, and call `peek()`. Then enqueue in the first and call `get()`.
Observed on `70c21145887920528d7d5540e3fb790b43e8b759`:
```text
cursor_before_peek=0
peek=second
cursor_after_peek=1
next_after_peek=second
next_without_peek=first
```
Version and commit evidence:
1.3.0-incubating-SNAPSHOT (main)
**Commit Hash (Optional)**
`70c21145887920528d7d5540e3fb790b43e8b759`
### Proposed Solution or Design
After: peek scans with a local cursor -> shared cursor stays unchanged -> later get preserves round-robin order
Expected behavior:
### Affected Area
Workflow Engine (Amber)
Contributor guide
Assessment
This issue has not been assessed yet.