Rate-cap validation matches to one in flight per team (#173) - #176
Open
razam-sherwani wants to merge 1 commit into
Open
Rate-cap validation matches to one in flight per team (#173)#176razam-sherwani wants to merge 1 commit into
razam-sherwani wants to merge 1 commit into
Conversation
Every submission scheduled a validation match (SubmissionController) with no throttle — the only submission limit was a cumulative storage quota — so a submission rush added one match per upload onto the shared queue. Reject the upload with 429 (before storing the file) when the team already has a validation match in flight. Counting includes created/scheduling as well as waiting/in_progress so a match in the create→enqueue window still counts. Added countTeamAMatchesByLadderAndStatus: validation matches have teamA==teamB and no initiatingTeam, so the existing initiatingTeam-keyed count would always return 0 for them. Co-Authored-By: Claude Opus 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.
Closes #173.
Problem
Every submission scheduled a validation match (
SubmissionController.uploadSubmission:144-156) with no throttle — the only submission limit was a cumulative storage quota. During a submission rush that adds one match per upload onto the shared queue, on top of matchmaking.Fix
Reject the upload with 429 when the team already has a validation match in flight, checked before the file is stored (a rejected upload consumes no storage). One in-flight validation per team is enough — a team waits for the pending result before resubmitting.
The count includes
created/schedulingas well aswaiting/in_progress, so a match sitting in the create→enqueue window still counts (the sharedcountTeamQueuedMatchesByLadderomits those two — that gap is noted in #160).Added
countTeamAMatchesByLadderAndStatus: validation matches are created withteamA == teamBand noinitiatingTeam, so the existinginitiatingTeam-keyed count returns 0 for them — the count has to key onteamA.Tests
SubmissionControllerIT.secondUploadWhileValidationInFlightIsRejected: first upload 200 + one job enqueued; second while the first is pending → 429, no second submission row, no second job.SubmissionValidationITandGameMatchServiceITstill green.Verified locally (no CI here): JDK-17 toolchain, Testcontainers Postgres+RabbitMQ. Independent of #172 and #174.
🤖 Generated with Claude Code