Revert "emerg: Import Locks should only be set if they are guaranteed to be unset."

This reverts commit 8a1bf480b1.
This commit is contained in:
zkldi
2022-03-24 16:15:12 +00:00
parent 8ab47ad0f8
commit d260bee4a3
3 changed files with 15 additions and 15 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "tachi-server",
"version": "2.1.10",
"version": "2.1.9",
"description": "A score tracking server.",
"main": "js/index.js",
"private": true,
+1 -1
View File
@@ -4,7 +4,7 @@
const MAJOR = 2;
const MINOR = 1;
const PATCH = 10;
const PATCH = 9;
// As is with all front-facing zkldi projects, the version names for tachi-server
// are from an album I like. In this case, the album is Portishead - Dummy.
@@ -64,20 +64,20 @@ export default async function ScoreImportMain<D, C>(
logger = providedLogger;
}
const hasNoOngoingImport = await CheckAndSetOngoingImportLock(user.id);
if (hasNoOngoingImport) {
logger.info(`User ${userID} made an import while they had one ongoing.`);
// @danger
// Throwing away an import if the user already has one outgoing is *bad*, as in the case
// of degraded performance we might just start throwing scores away.
// Under normal circumstances, there is no scenario where a user would have two ongoing
// imports at the same time - even if they were using single-score imports on a 5 second
// chart, as each score import takes only around ~10-15milliseconds.
throw new ScoreImportFatalError(409, "This user already has an ongoing import.");
}
try {
const hasNoOngoingImport = await CheckAndSetOngoingImportLock(user.id);
if (hasNoOngoingImport) {
logger.info(`User ${userID} made an import while they had one ongoing.`);
// @danger
// Throwing away an import if the user already has one outgoing is *bad*, as in the case
// of degraded performance we might just start throwing scores away.
// Under normal circumstances, there is no scenario where a user would have two ongoing
// imports at the same time - even if they were using single-score imports on a 5 second
// chart, as each score import takes only around ~10-15milliseconds.
throw new ScoreImportFatalError(409, "This user already has an ongoing import.");
}
const timeStarted = Date.now();
SetJobProgress(job, "Parsing score data.");