mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02:00
[web] try harder at flushing projects during soft deletion (#32454)
GitOrigin-RevId: 2e35e75d4219b720e7d12ff7a5534bf1ed302d98
This commit is contained in:
@@ -184,9 +184,30 @@ async function deleteProject(projectId, options = {}) {
|
||||
throw new Errors.NotFoundError('project not found')
|
||||
}
|
||||
|
||||
await DocumentUpdaterHandler.promises.flushProjectToMongoAndDelete(
|
||||
projectId
|
||||
)
|
||||
try {
|
||||
// flushProjectToMongoAndDelete performs flush to mongo and history.
|
||||
await DocumentUpdaterHandler.promises.flushProjectToMongoAndDelete(
|
||||
projectId
|
||||
)
|
||||
} catch (err) {
|
||||
// Try harder at flushing the project.
|
||||
// Step 1: Flush to mongo, do not delete yet
|
||||
await DocumentUpdaterHandler.promises.flushProjectToMongo(projectId)
|
||||
try {
|
||||
// Step 2: Attempt to flush the history, this will likely fail.
|
||||
await HistoryManager.promises.flushProject(projectId)
|
||||
} catch {
|
||||
// We found a project with a broken history.
|
||||
// Step 3: Resync the history
|
||||
await HistoryManager.promises.resyncProject(projectId, {
|
||||
force: true,
|
||||
})
|
||||
}
|
||||
// Step 4: Try again, this time delete the docs
|
||||
await DocumentUpdaterHandler.promises.flushProjectToMongoAndDelete(
|
||||
projectId
|
||||
)
|
||||
}
|
||||
|
||||
try {
|
||||
// OPTIMIZATION: flush docs out of mongo
|
||||
|
||||
Reference in New Issue
Block a user