Skip to content

Commit ab0361c

Browse files
committed
chore: Removing pre-check and relying on P2002 handling (#2627)
1 parent f5c2ee9 commit ab0361c

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/lib/services/contest_task_pairs.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,6 @@ export async function createContestTaskPair(
4848
taskId: string,
4949
): Promise<void> {
5050
try {
51-
const existingRecord = await getContestTaskPair(contestId, taskId);
52-
53-
if (existingRecord) {
54-
console.log(`ContestTaskPair already exists: contestId=${contestId}, taskId=${taskId}`);
55-
return;
56-
}
57-
5851
const contestTaskPair = await db.contestTaskPair.create({
5952
data: {
6053
contestId,
@@ -66,7 +59,7 @@ export async function createContestTaskPair(
6659
console.log('Created ContestTaskPair:', contestTaskPair);
6760
} catch (error) {
6861
if (error && typeof error === 'object' && 'code' in error && (error as any).code === 'P2002') {
69-
console.log(`Found ContestTaskPair (race): contestId=${contestId}, taskId=${taskId}`);
62+
console.log(`ContestTaskPair already exists: contestId=${contestId}, taskId=${taskId}`);
7063
return;
7164
}
7265

0 commit comments

Comments
 (0)