Add site name for backup events
This commit is contained in:
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user