Skip to content

Race condition - #232

Merged
crystaltine merged 5 commits into
mainfrom
race-condition
Aug 30, 2026
Merged

Race condition#232
crystaltine merged 5 commits into
mainfrom
race-condition

Conversation

@albertying

Copy link
Copy Markdown
Contributor

limit to judge per project at a time
fix race condition of 2 judges getting assigned to a project at the same time

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent a race where multiple judges can be auto-assigned to the same project concurrently by making auto-assignment selection + creation atomic.

Changes:

  • Wraps auto-assignment logic in a Prisma interactive transaction and adds a Postgres advisory lock.
  • Adjusts project eligibility and selection logic to avoid projects that are currently QUEUED and to balance by completed assignment counts.
  • Adds a concurrency warning log when a project is unexpectedly already QUEUED.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread services/expo/src/routes/assignments.ts Outdated
Comment thread services/expo/src/routes/assignments.ts Outdated
@crystaltine
crystaltine merged commit 09f9e91 into main Aug 30, 2026
3 checks passed
@crystaltine
crystaltine deleted the race-condition branch August 30, 2026 23:37
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.

3 participants