Skip to content

feat(velocity): pace drain transfers instead of sending them all at once - #85

Merged
hbrombeer merged 1 commit into
mainfrom
feat/staggered-proxy-drain
Oct 13, 2026
Merged

hbrombeer merged 1 commit into
mainfrom
feat/staggered-proxy-drain

Conversation

@hbrombeer

Copy link
Copy Markdown
Member

Previously the proxy drain sent every transfer packet at the same moment, at drain start and again at the deadline. 400 players on one proxy meant 400 reconnects within a second: logins, Mojang session checks and service lookups all hitting the new proxy together.

Now:

  • PacedTransfers: the first batch goes out immediately, then one batch per second. The rate is GROUNDS_DRAIN_TRANSFERS_PER_SECOND, default 20, so 400 players take 20 s, well within the 830 s deadline.
  • Applies at drain start and at the deadline.
  • Each player is checked again when their turn comes. Players who disconnected, or switched into a round, are skipped and don't use up a slot; round players still go through interceptConnect once their round ends.
  • The lobby drain (OutdatedLobbyMover) was already staggered (10 per 5 s per proxy) and is unchanged.

Tests: PacedTransfersTest covers batching 45 → 20/20/5, skipping without using a slot, failure handling (it absorbs the old DrainTransferSafetyTest), and the config default and validation. ./gradlew :velocity:test spotlessCheck build is green.

A drain sent every transfer packet in the same instant, so a full proxy
reconnected in one burst: hundreds of logins, Mojang session checks and
service lookups on the replacement proxy at once. Transfers now go out in
batches of GROUNDS_DRAIN_TRANSFERS_PER_SECOND (default 20) once a second, at
drain start and at the deadline. A queued player who left or walked into a
round is skipped without using a slot.
@sonarqubecloud

Copy link
Copy Markdown

@hbrombeer
hbrombeer merged commit fe9bf5b into main Oct 13, 2026
3 checks passed
@hbrombeer
hbrombeer deleted the feat/staggered-proxy-drain branch October 13, 2026 16:43
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