Harden match and tournament code concurrency
This commit is contained in:
1 parent
292e37aaac
commit
df7dcd3a9c
9 files changed
+2339
-128
No files matched your search
@@ -1492,10 +1492,36 @@ export const TournamentCodeSchema = new Schema<TournamentCode>(
|
||||
|
||||
TournamentCodeSchema.index({ code: 1 }, { unique: true });
|
||||
TournamentCodeSchema.index({ state: 1, expiresAt: 1 });
|
||||
TournamentCodeSchema.index({ matchId: 1, gameNumber: 1 });
|
||||
TournamentCodeSchema.index({ matchId: 1, bracketMatchId: 1 }, { sparse: true });
|
||||
TournamentCodeSchema.index(
|
||||
{ matchId: 1, gameNumber: 1 },
|
||||
{
|
||||
unique: true,
|
||||
partialFilterExpression: {
|
||||
matchId: { $exists: true },
|
||||
gameNumber: { $exists: true },
|
||||
state: { $in: ['reserved', 'used'] },
|
||||
},
|
||||
},
|
||||
);
|
||||
TournamentCodeSchema.index(
|
||||
{ matchId: 1, bracketMatchId: 1 },
|
||||
{
|
||||
unique: true,
|
||||
partialFilterExpression: {
|
||||
matchId: { $exists: true },
|
||||
bracketMatchId: { $exists: true },
|
||||
state: { $in: ['reserved', 'used'] },
|
||||
},
|
||||
},
|
||||
);
|
||||
TournamentCodeSchema.index({ state: 1, uploadedAt: -1 });
|
||||
TournamentCodeSchema.index({ riotMatchId: 1 }, { sparse: true });
|
||||
TournamentCodeSchema.index(
|
||||
{ riotMatchId: 1 },
|
||||
{
|
||||
unique: true,
|
||||
partialFilterExpression: { riotMatchId: { $type: 'string' } },
|
||||
},
|
||||
);
|
||||
|
||||
const MatchParticipantSubSchema = new Schema<MatchParticipant>(
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user