Add site name for backup events

This commit is contained in:
Girish Ramakrishnan
2025-10-09 17:24:43 +02:00
parent 5bc3cb6353
commit b2a41cc4d5
2 changed files with 6 additions and 6 deletions

View File

@@ -381,16 +381,16 @@ async function startBackupTask(site, auditSource) {
const taskId = await tasks.add(`${tasks.TASK_FULL_BACKUP_PREFIX}${site.id}`, [ site.id, { /* options */ } ]);
await eventlog.add(eventlog.ACTION_BACKUP_START, auditSource, { taskId, siteId: site.id });
await eventlog.add(eventlog.ACTION_BACKUP_START, auditSource, { taskId, siteId: site.id, siteName: site.name });
// background
tasks.startTask(taskId, { timeout: 24 * 60 * 60 * 1000 /* 24 hours */, nice: 15, memoryLimit, oomScoreAdjust: -999 })
.then(async (result) => { // this can be the an array or string depending on site.contents
await eventlog.add(eventlog.ACTION_BACKUP_FINISH, auditSource, { taskId, result, siteId: site.id });
await eventlog.add(eventlog.ACTION_BACKUP_FINISH, auditSource, { taskId, result, siteId: site.id, siteName: site.name });
})
.catch(async (error) => {
const timedOut = error.code === tasks.ETIMEOUT;
await safe(eventlog.add(eventlog.ACTION_BACKUP_FINISH, auditSource, { taskId, errorMessage: error.message, timedOut, siteId: site.id }));
await safe(eventlog.add(eventlog.ACTION_BACKUP_FINISH, auditSource, { taskId, errorMessage: error.message, timedOut, siteId: site.id, siteName: site.name }));
})
.finally(async () => {
await locks.release(`${locks.TYPE_FULL_BACKUP_TASK_PREFIX}${site.id}`);