Преглед на файлове

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

clear redis before migrating projects without history

GitOrigin-RevId: 9f1ba14f6a7c5d6a7f1a55fcfeb3778b15a84561
Brian Gough преди 3 години
родител
ревизия
e9c0f4363a
променени са 1 файла, в които са добавени 6 реда и са изтрити 0 реда
  1. 6 0
      services/web/modules/history-migration/app/src/HistoryUpgradeHelper.js

+ 6 - 0
services/web/modules/history-migration/app/src/HistoryUpgradeHelper.js

@@ -7,6 +7,7 @@ const HistoryManager = require('../../../../app/src/Features/History/HistoryMana
 const ProjectHistoryController = require('./ProjectHistoryController')
 const ProjectHistoryController = require('./ProjectHistoryController')
 const ProjectEntityHandler = require('../../../../app/src/Features/Project/ProjectEntityHandler')
 const ProjectEntityHandler = require('../../../../app/src/Features/Project/ProjectEntityHandler')
 const ProjectEntityUpdateHandler = require('../../../../app/src/Features/Project/ProjectEntityUpdateHandler')
 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
 // Timestamp of when 'Enable history for SL in background' release
 const ID_WHEN_FULL_PROJECT_HISTORY_ENABLED = '5a8d8a370000000000000000'
 const ID_WHEN_FULL_PROJECT_HISTORY_ENABLED = '5a8d8a370000000000000000'
@@ -196,6 +197,11 @@ async function doUpgradeForNoneWithoutConversion(project) {
         await ProjectHistoryHandler.promises.setHistoryId(projectId, historyId)
         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, {
     await HistoryManager.promises.resyncProject(projectId, {
       force: true,
       force: true,
       origin: { kind: 'history-migration' },
       origin: { kind: 'history-migration' },