tasks: rework the startTask API

it is now async. change was required to reset the pending flag
This commit is contained in:
Girish Ramakrishnan
2025-06-17 18:54:12 +02:00
parent 4770b32287
commit d9c104613c
13 changed files with 178 additions and 202 deletions

View File

@@ -321,10 +321,12 @@ async function startChangeLocation(subdomain, domain, auditSource) {
await setLocation(subdomain, domain);
const taskId = await tasks.add(tasks.TASK_CHANGE_MAIL_LOCATION, [ auditSource ]);
tasks.startTask(taskId, {}, async (error) => {
if (error) return;
await platform.onMailServerLocationChanged(auditSource);
});
// background
tasks.startTask(taskId, {})
.then(async () => {
await platform.onMailServerLocationChanged(auditSource);
})
.catch((error) => debug(`startChangeLocation`, error));
await eventlog.add(eventlog.ACTION_MAIL_LOCATION, auditSource, { subdomain, domain, taskId });
return taskId;