-
Notifications
You must be signed in to change notification settings - Fork 28
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
base: master
Are you sure you want to change the base?
Conversation
@@ -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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
- 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.
- 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.
There was a problem hiding this comment.
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?
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: