Merge pull request #8786 from overleaf/bg-check-age-for-migration

enforce cutoff date for track-changes history migration

GitOrigin-RevId: cd7b76281c66b7e6edc856d70660f2c5b8ae5275
This commit is contained in:
Brian Gough 2022-07-11 09:11:30 +01:00 committed by Copybot
parent 73f85d6e51
commit e32d1dbdd6

View file

@ -13,7 +13,9 @@ const FIX_INVALID_CHARACTERS = process.env.FIX_INVALID_CHARACTERS === 'true'
const FORCE_NEW_HISTORY_ON_FAILURE =
process.env.FORCE_NEW_HISTORY_ON_FAILURE === 'true'
const IMPORT_ZIP_FILE_PATH = process.env.IMPORT_ZIP_FILE_PATH
const CUTOFF_DATE = process.env.CUTOFF_DATE
? new Date(process.env.CUTOFF_DATE)
: undefined
// persist fallback in order to keep batchedUpdate in-sync
process.env.BATCH_SIZE = BATCH_SIZE
// raise mongo timeout to 1hr if otherwise unspecified
@ -50,6 +52,7 @@ console.log({
CONVERT_LARGE_DOCS_TO_FILE,
USER_ID,
IMPORT_ZIP_FILE_PATH,
CUTOFF_DATE,
})
const RESULT = {
@ -143,6 +146,7 @@ async function doUpgradeForNoneWithConversion(project) {
fixInvalidCharacters: FIX_INVALID_CHARACTERS,
forceNewHistoryOnFailure: FORCE_NEW_HISTORY_ON_FAILURE,
importZipFilePath: IMPORT_ZIP_FILE_PATH,
cutoffDate: CUTOFF_DATE,
})
} catch (err) {
// if migrateProjectHistory fails, it cleans up by deleting