apptaskmanager: release lock and clear active task on task failure

This commit is contained in:
Girish Ramakrishnan
2025-07-17 14:54:41 +02:00
parent 7047ee9391
commit 17ce6f7291

View File

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