Merge pull request #3372 from overleaf/jpa-archive-docs-on-soft-delete

[ProjectDeleter] flush docs out of mongo when soft-deleting a project

GitOrigin-RevId: 52f3e1298af5ca481ba9b27b18c9190063019988
This commit is contained in:
Simon Detheridge
2020-11-10 03:04:30 +00:00
committed by Copybot
parent 94092c905b
commit da8663fd0f
2 changed files with 39 additions and 0 deletions
@@ -240,6 +240,18 @@ async function deleteProject(projectId, options = {}) {
projectId
)
try {
// OPTIMIZATION: flush docs out of mongo
await DocstoreManager.promises.archiveProject(projectId)
} catch (err) {
// It is OK to fail here, the docs will get hard-deleted eventually after
// the grace-period for soft-deleted projects has passed.
logger.warn(
{ projectId, err },
'failed archiving doc via docstore as part of project soft-deletion'
)
}
const memberIds = await CollaboratorsGetter.promises.getMemberIds(projectId)
// fire these jobs in the background