From a822819582b81cd67c07f32e3b118c42a8b966a4 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Mon, 11 Jul 2022 09:11:04 +0100 Subject: [PATCH] Merge pull request #8762 from overleaf/bg-force-new-history-on-failure [web] allow forcing new history on migration failure GitOrigin-RevId: bf84a6edf5a10b6aa3a1653e13a213552cb9272e --- .../history/upgrade_none_with_conversion_if_sl_history.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/web/scripts/history/upgrade_none_with_conversion_if_sl_history.js b/services/web/scripts/history/upgrade_none_with_conversion_if_sl_history.js index a05e4bc386..979e756dbf 100644 --- a/services/web/scripts/history/upgrade_none_with_conversion_if_sl_history.js +++ b/services/web/scripts/history/upgrade_none_with_conversion_if_sl_history.js @@ -10,6 +10,8 @@ const MAX_UPGRADES_TO_ATTEMPT = const MAX_FAILURES = parseInt(process.env.MAX_FAILURES, 10) || 50 const ARCHIVE_ON_FAILURE = process.env.ARCHIVE_ON_FAILURE === 'true' const FIX_INVALID_CHARACTERS = process.env.FIX_INVALID_CHARACTERS === 'true' +const FORCE_NEW_HISTORY_ON_FAILURE = + process.env.FORCE_NEW_HISTORY_ON_FAILURE === 'true' // persist fallback in order to keep batchedUpdate in-sync process.env.BATCH_SIZE = BATCH_SIZE @@ -42,6 +44,10 @@ console.log({ RETRY_FAILED, ARCHIVE_ON_FAILURE, PROJECT_ID, + FIX_INVALID_CHARACTERS, + FORCE_NEW_HISTORY_ON_FAILURE, + CONVERT_LARGE_DOCS_TO_FILE, + USER_ID, }) const RESULT = { @@ -133,6 +139,7 @@ async function doUpgradeForNoneWithConversion(project) { await ProjectHistoryController.migrateProjectHistory(projectIdString, { archiveOnFailure: ARCHIVE_ON_FAILURE, fixInvalidCharacters: FIX_INVALID_CHARACTERS, + forceNewHistoryOnFailure: FORCE_NEW_HISTORY_ON_FAILURE, }) } catch (err) { // if migrateProjectHistory fails, it cleans up by deleting