Conversation
|
👋 mchain0, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
|
✅ No conflicts with other open PRs targeting |
|
I see you updated files related to
|
|
| nowMs := time.Now().UnixMilli() | ||
| creationTs := s.messageCache.Insert(key, sender, nowMs, msg.Payload) | ||
| ready, payloads := s.messageCache.Ready(key, cfg.remoteConfig.MinResponsesToAggregate, nowMs-cfg.remoteConfig.MessageExpiry.Milliseconds(), true) | ||
|
|
There was a problem hiding this comment.
@mchain0 This is indeed a brain twister 😬
Am I missing something, or would it be enough to basically have the same code as before, but just add MarkDelivered to line 385? In other words, we're quite happy for Ready() to return true multiple times as long as we fail to aggregate (so that each subsequent message gives us a chance to re-aggregate); however once we have successfully aggregated, we should consume the one-shot.
There was a problem hiding this comment.
ok, I applied this and rerun the test - it seems to be ok-ish ...
two concerns:
- Receive is single-thread, so as long as this concurrency stays like it - we're safe
- TestMessageCache_InsertReady test fails after the change, it expects Ready(once=true) to be one-shot by itself, so I would have to change this test - no idea what's the impact of changing this behavior
also this would would mean Ready never sets wasReady only MarkDelivered does - that's cleaner




one-shot readiness effect with a regression test
all details in the JIRA issue linked below
cre-5718
A note for the reviewer:
The fix extends the s.mu critical section to include Aggregate().
Before (original):
After (fix):
As far as I checked the latency it's marginally worse, but pls think about cases where this could go south. There is an option to make it non-blocking, but it would make this code even less readable.