tasks: rework the startTask API
it is now async. change was required to reset the pending flag
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user