Skip to content

Commit

Permalink
Fix the majority of verification race conditions
Browse files Browse the repository at this point in the history
Data races can probably still occur in the following cases:
- If Discord is still adding the role when we fetch the user for the
  second time
- If we don't all verify, for example if someone does a kick and someone
  else does a verify

These are substantially less likely than the common case, which has
happened several times now

This was ported over from TransGG/theo#5
  • Loading branch information
Minion3665 committed Dec 30, 2022
1 parent 145bfb4 commit 5d6c8f6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/verification/managers/verifyUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ async function verifyUser(ticket, verifier, resolve, reject) {
return;
}

if (applicant.roles.cache.has(config.roles.verified)) {
await reject('User has already been verified');
return;
}

// verify user
await verify(applicant);

Expand Down

0 comments on commit 5d6c8f6

Please sign in to comment.