Repository navigation
Multi-proxy support (Redis + shared MySQL) and cache/SQL race fixes - #1
Merged
Merged
Conversation
Multi-proxy - Every cross-proxy change is an Event (sealed records) applied by Friends.apply on the proxy where it happens and on every other proxy; Network.LOCAL keeps single-proxy setups unchanged. - RedisNetwork (Jedis 8): presence hash, one TTL key per request, per-proxy heartbeat with reaping of dead proxies, pub/sub fan-out, resync after reconnects, SET NX claim for crossing accepts. - Events are published through the SQL queue, so other proxies only see a change once it is stored. - Velocity: redis config section (requires MySQL), server switches announced, shutdown flushes writes then leaves the network. Correctness and optimization - One lock around decide + cache update + queued write: fixes cache/database drift found by the new randomized and concurrent consistency tests. - Re-read a profile whose friendships changed while it was loading. - HikariCP-recommended MySQL statement/metadata caching. - Sorted, network-wide tab completion (hides players appearing offline). Tests: 86 total (SQLite, MySQL, real Redis, in-memory multi-proxy hub, randomized cache-vs-database checks with a lagging database, concurrency). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
storage.type: mysqlon every proxy, thenredis.enabled: truewith a uniqueredis.proxy-idon each. Requests, accept/deny, join/leave messages, status, current server,/f listand tab completion then work across proxies.Network.LOCALis a no-op.How
Event(a sealed interface of records). The proxy where it happens applies it, then publishes it; every other proxy applies the same event inFriends.apply.RedisNetwork(Jedis 8):SET NXclaim so crossing accepts on two proxies can't both go through.Fixes found by the new tests
/f besttoggles. Fixed with one lock around decide, cache update and queued write..claude/known_errors.md.Tests
86 tests pass locally (SQLite, MySQL 8.0.46, Redis 8.10.2):
Each race guard has a test that fails when the guard is removed. The exception is the lock: its random stress test only fails occasionally without it.
Also tested with two real Velocity 4.2.0 proxies sharing MySQL and Redis: logins on both proxies, correct events, a
kill -9on one proxy reaped by the other after about 40 s, and clean shutdown.Not covered: gameplay through a real client on a backend server (the local test client can log in but not play).
🤖 Generated with Claude Code