This commit is contained in:
dahyeon committed 2026-04-27 19:31:31 -07:00
1 parent 4dba82ca03
commit 6609098037
2 files changed
+5 -3

No files matched your search

@@ -208,7 +208,7 @@ export class LegacyImportService {
state: { $in: ['pending', 'running'] }, state: { $in: ['pending', 'running'] },
}, },
{ $set: { state: 'cancelled', completedAt: new Date() } }, { $set: { state: 'cancelled', completedAt: new Date() } },
{ new: true }, { returnDocument: 'after' },
).exec(); ).exec();
if (!job) throw new NotFoundException('Running legacy import job not found.'); if (!job) throw new NotFoundException('Running legacy import job not found.');
await this.garnetService.delete(this.communityLockKey(params.communityId)); await this.garnetService.delete(this.communityLockKey(params.communityId));
@@ -245,7 +245,7 @@ export class TournamentCodeService {
}, },
$unset: { releasedAt: 1 }, $unset: { releasedAt: 1 },
}, },
{ sort: { expiresAt: 1 }, new: true }, { sort: { expiresAt: 1 }, returnDocument: 'after' },
).exec(); ).exec();
if (!code) break; if (!code) break;
reservedIds.push(code._id); reservedIds.push(code._id);
@@ -314,8 +314,10 @@ export class TournamentCodeService {
if ((match.tournamentCodeIds?.length ?? 0) >= (match.gameCount || 0)) { if ((match.tournamentCodeIds?.length ?? 0) >= (match.gameCount || 0)) {
continue; continue;
} }
const before = match.tournamentCodeIds?.length ?? 0;
await this.reserveForMatch(match); await this.reserveForMatch(match);
touched += 1; const after = match.tournamentCodeIds?.length ?? 0;
if (after > before) touched += 1;
} }
return touched; return touched;
} }