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

@@ -49,13 +49,16 @@ async function drain() {
scheduler.suspendAppJobs(appId);
tasks.startTask(taskId, Object.assign(options, { logFile }), async function (error, result) {
onFinished(error, result);
// background
tasks.startTask(taskId, Object.assign(options, { logFile }))
.then(async (result) => {
onFinished(null, result);
delete gActiveTasks[appId];
await locks.release(`${locks.TYPE_APP_PREFIX}${appId}`);
scheduler.resumeAppJobs(appId);
});
delete gActiveTasks[appId];
await locks.release(`${locks.TYPE_APP_PREFIX}${appId}`);
scheduler.resumeAppJobs(appId);
})
.catch(onFinished);
}
gDrainTimerId = null;