Skip to content

Assignment Quotas: Fix race condition #2586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

haroldrubio
Copy link
Member

This PR adds a fix to the assignment/invite assignment quota caused by a delay in inserting data into Mongo. This delay adds a race condition where two invites get sent out while receiving outdated information on the number of assignments to a paper. For example, 2 assignments are already made, and 2 invite assignment requests are made quickly. Only one of these should post but both of these will post causing errors in any subsequent assignments to that paper.

The fix:

  1. Bypasses the quota for invite assignment edges already posted - any invite assignments will be able to be updated regardless of if they exceed the quota.
  2. Add a small margin of error in the assignment pre-process that allows for cases that exceed the quota

@haroldrubio haroldrubio self-assigned this May 14, 2025
@melisabok melisabok marked this pull request as ready for review May 28, 2025 15:04
@@ -31,7 +31,7 @@ async function process(client, edge, invitation) {
// Filter invite assignment edges to exclude edges that are accepted
const filteredInviteAssignmentEdges = inviteAssignmentEdges.filter(e => !filteredLabels.includes(e?.label ?? ''))

if (quota && filteredInviteAssignmentEdges.length + filteredAssignmentEdges.length >= quota) {
if (quota && filteredInviteAssignmentEdges.length + filteredAssignmentEdges.length >= quota + 1) {
Copy link
Member

Choose a reason for hiding this comment

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

if you relax this validation, all the papers can have quota + 1 assignments, is this what we want?

Copy link
Member

@melisabok melisabok May 28, 2025

Choose a reason for hiding this comment

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

There are two options to solve this:

  1. Reject the assignment for the invited reviewer that accepted the invitation. Send an email saying the paper already has enough reviewers and their review is not needed anymore.
  2. Bypass the validation here by checking that if that assignment is coming from an invite assignment then let it post the edge. You can check that is the edge that we are trying to post already exists as an invite assignment (same head and tail) then we let the edge to be posted. As a summary: only check the quota when the assignment edge doesn't come from an invite assignment.

Copy link
Member

Choose a reason for hiding this comment

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

@haroldrubio any updates on this?

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.

2 participants