Buffer and sync metrics#1963
Conversation
- DeltaBuffer.push: Only increment drops counter when pop_front() actually evicts an element. Fixes false positive drops at zero capacity where pop_front() returns None on empty deque. - SyncComplete handler: Add record_write() call for replayed operations to match GossipDelta and apply_actions behavior. Ensures write metrics are consistent across all code paths.
|
Cursor Agent can help with this pull request. Just |
|
Your PR title does not adhere to the Conventional Commits convention: Common errors to avoid:
|
There was a problem hiding this comment.
🤖 AI Code Reviewer
Reviewed by 3 agents | Quality score: 100% | Review time: 144.9s
📝 1 nitpicks. See inline comments.
🤖 Generated by AI Code Reviewer | Review ID: review-5b66b860
| // Evict oldest delta (front of queue) | ||
| let _evicted = self.deltas.pop_front(); | ||
| self.drops += 1; | ||
| // Only increment drops if we actually evicted something |
There was a problem hiding this comment.
📝 Nit: Edge case handling could be documented or prevented at construction
The pop_front().is_some() check only triggers when capacity == 0 (otherwise len >= capacity guarantees non-empty deque); consider adding a debug_assert or constructor validation for capacity > 0 rather than silently handling this edge case.
Suggested fix:
Add `debug_assert!(self.capacity > 0, "DeltaBuffer with zero capacity");` or validate in `new()`
|
This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated. |
This pull request contains changes generated by a Cursor Cloud Agent