Merge pull request #11541 from overleaf/bg-fix-doUpgradeForNoneWithoutConversion

clear redis before migrating projects without history

GitOrigin-RevId: 9f1ba14f6a7c5d6a7f1a55fcfeb3778b15a84561
This commit is contained in:
Brian Gough 2023-01-31 09:18:33 +00:00 committed by Copybot
parent 78304e7c94
commit e9c0f4363a

View file

@ -7,6 +7,7 @@ const HistoryManager = require('../../../../app/src/Features/History/HistoryMana
const ProjectHistoryController = require('./ProjectHistoryController')
const ProjectEntityHandler = require('../../../../app/src/Features/Project/ProjectEntityHandler')
const ProjectEntityUpdateHandler = require('../../../../app/src/Features/Project/ProjectEntityUpdateHandler')
const DocumentUpdaterHandler = require('../../../../app/src/Features/DocumentUpdater/DocumentUpdaterHandler')
// Timestamp of when 'Enable history for SL in background' release
const ID_WHEN_FULL_PROJECT_HISTORY_ENABLED = '5a8d8a370000000000000000'
@ -196,6 +197,11 @@ async function doUpgradeForNoneWithoutConversion(project) {
await ProjectHistoryHandler.promises.setHistoryId(projectId, historyId)
}
}
// tell document updater to clear the docs, they will be reloaded with any new history id
await DocumentUpdaterHandler.promises.flushProjectToMongoAndDelete(
projectId
)
// now resync the project
await HistoryManager.promises.resyncProject(projectId, {
force: true,
origin: { kind: 'history-migration' },