From e81725df87a929f704a3e657a1235671aa3ef149 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Tue, 1 Feb 2022 02:02:30 +0000 Subject: [PATCH] Remove unused crit logging --- .../framework/import-locks/lock.ts | 2 -- .../lib/score-import/framework/score-import.ts | 18 ++++++++++++++---- .../score-importing/score-import-main.ts | 4 ---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/server/src/lib/score-import/framework/import-locks/lock.ts b/server/src/lib/score-import/framework/import-locks/lock.ts index 8d054dbdd..cb632a0ea 100644 --- a/server/src/lib/score-import/framework/import-locks/lock.ts +++ b/server/src/lib/score-import/framework/import-locks/lock.ts @@ -32,8 +32,6 @@ export async function CheckAndSetOngoingImportLock(userID: integer) { } ); - rootLogger.crit("", lockWasSet); - return !lockWasSet; } diff --git a/server/src/lib/score-import/framework/score-import.ts b/server/src/lib/score-import/framework/score-import.ts index d687ee9f3..80b2a3b5f 100644 --- a/server/src/lib/score-import/framework/score-import.ts +++ b/server/src/lib/score-import/framework/score-import.ts @@ -28,9 +28,9 @@ export async function MakeScoreImport( if (ServerConfig.USE_EXTERNAL_SCORE_IMPORT_WORKER && process.env.IS_JOB === undefined) { let timesAttempted = 1; - // There's no chance this thing goes on 10 times. - // if it does, this import has been trying for the past 2 days or so. - while (timesAttempted < 10) { + // There's no chance this thing goes on 7 times. + // if it does, this import has been trying for the past 6 hours or so. + while (timesAttempted <= 7) { const job = await ScoreImportQueue.add( `Import ${jobData.importID}${timesAttempted > 0 ? ` (TRY${timesAttempted})` : ""}`, jobData, @@ -64,7 +64,15 @@ export async function MakeScoreImport( timesAttempted++; } - throw new ScoreImportFatalError(409, "Couldn't get an import at all."); + logger.error( + `User ${jobData.userID} didn't get an import through in around 6 hours. Has their lock gotten stuck?`, + jobData + ); + + throw new ScoreImportFatalError( + 409, + "Couldn't get an import through in the past 6 hours, at all." + ); } else { const InputParser = GetInputParser(jobData); @@ -85,6 +93,8 @@ function ExponentialBackoff(exponent: integer) { // 2 | 64 Seconds // 3 | 256 Seconds // 4 | 1024 Seconds + // ... + // ends at 7, which is around 4 hours. return 1000 * 4 ** exponent; } diff --git a/server/src/lib/score-import/framework/score-importing/score-import-main.ts b/server/src/lib/score-import/framework/score-importing/score-import-main.ts index 7d66cc583..1537d1739 100644 --- a/server/src/lib/score-import/framework/score-importing/score-import-main.ts +++ b/server/src/lib/score-import/framework/score-importing/score-import-main.ts @@ -42,8 +42,6 @@ export default async function ScoreImportMain( providedLogger?: KtLogger, job?: ScoreImportJob ) { - rootLogger.crit(`HIT from ${userID} ${importID}.`); - const user = await GetUserWithID(userID); if (!user) { @@ -245,8 +243,6 @@ export default async function ScoreImportMain( }, }); - rootLogger.crit(`END ${importID}.`); - return ImportDocument; } finally { await UnsetOngoingImportLock(user.id);