Merge pull request #7735 from overleaf/jpa-fix-hard-deletion

[web] fix result handling from project-archiver hard deletion

GitOrigin-RevId: c6d7746e5e45b05d6372e5efcc029e0b566ace2d
This commit is contained in:
Timothée Alby 2022-04-25 13:05:32 +02:00 committed by Copybot
parent b289afe23c
commit 62075a6ba9
2 changed files with 5 additions and 4 deletions

View file

@ -113,16 +113,17 @@ async function deleteProject(options) {
metrics.inc('tpds.delete-project')
// send the request directly to project archiver, bypassing third-party-datastore
try {
const response = await request({
await request({
uri: `${settings.apis.project_archiver.url}/project/${options.project_id}`,
method: 'delete',
})
return response
return true
} catch (err) {
logger.error(
{ err, project_id: options.project_id },
'error deleting project in third party datastore (project_archiver)'
)
return false
}
}

View file

@ -74,10 +74,10 @@ async function hardDeleteProjectArchiverData(projectId) {
console.log(`Destroying hard deleted project archive for ${projectId}`)
if (DRY_RUN) return
const res = await TpdsUpdateSender.promises.deleteProject({
const ok = await TpdsUpdateSender.promises.deleteProject({
project_id: projectId,
})
if (!res) {
if (!ok) {
throw new Error(`deletion failed for ${projectId}, check logs`)
}
}