Skip to content

Make proxy cache vote deduplication atomic#1531

Merged
BenCodez merged 1 commit into
masterfrom
agent/atomic-proxy-cache-dedup
Jul 19, 2026
Merged

Make proxy cache vote deduplication atomic#1531
BenCodez merged 1 commit into
masterfrom
agent/atomic-proxy-cache-dedup

Conversation

@BenCodez

Copy link
Copy Markdown
Owner

Summary

  • synchronize server-cache vote insertion across the duplicate check, in-memory add, and persistence
  • synchronize online-cache vote insertion across the same operation
  • add concurrent regression tests for both cache paths

Why

The existing contains-then-add flow was correct for sequential delivery but was not atomic. Two simultaneous deliveries with the same voteId could both pass the duplicate check and be cached/persisted twice.

Impact

Duplicate reservation is now atomic per VoteCacheHandler instance. The synchronized sections are short and vote traffic is low-volume, so contention should be negligible.

Validation

The new tests start two delivery threads behind a latch and assert that only one cache entry and one persistence call are produced for server and online caches.

@BenCodez
BenCodez marked this pull request as ready for review July 19, 2026 19:46
@BenCodez
BenCodez merged commit dd1ad37 into master Jul 19, 2026
4 checks passed
@BenCodez
BenCodez deleted the agent/atomic-proxy-cache-dedup branch July 19, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant