turbowatch
Advanced tools
Comparing version 2.29.2 to 2.29.3
@@ -139,8 +139,15 @@ "use strict"; | ||
outerActiveTask.abortController.abort(); | ||
const abortedTaskPromise = outerActiveTask.promise; | ||
// Do not start a new task until the previous task has been | ||
// aborted and the shutdown routine has run to completion. | ||
await abortedTaskPromise; | ||
// eslint-disable-next-line require-atomic-updates | ||
outerActiveTask = null; | ||
log.debug('%s (%s): waiting for task to abort', trigger.name, outerActiveTask.id); | ||
if (outerActiveTask.queued) { | ||
return undefined; | ||
} | ||
outerActiveTask.queued = true; | ||
try { | ||
// Do not start a new task until the previous task has been | ||
// aborted and the shutdown routine has run to completion. | ||
await outerActiveTask.promise; | ||
} | ||
catch (_a) { | ||
// nothing to do | ||
} | ||
} | ||
@@ -160,3 +167,3 @@ else { | ||
} | ||
catch (_a) { | ||
catch (_b) { | ||
// nothing to do | ||
@@ -181,3 +188,3 @@ } | ||
}) // eslint-disable-next-line promise/prefer-await-to-then | ||
.then(() => { | ||
.finally(() => { | ||
if (taskId === (outerActiveTask === null || outerActiveTask === void 0 ? void 0 : outerActiveTask.id)) { | ||
@@ -184,0 +191,0 @@ log.debug('%s (%s): completed task', trigger.name, taskId); |
@@ -70,3 +70,3 @@ { | ||
"types": "./dist/index.d.ts", | ||
"version": "2.29.2" | ||
"version": "2.29.3" | ||
} |
@@ -230,10 +230,21 @@ import { createSpawn } from './createSpawn'; | ||
const abortedTaskPromise = outerActiveTask.promise; | ||
log.debug( | ||
'%s (%s): waiting for task to abort', | ||
trigger.name, | ||
outerActiveTask.id, | ||
); | ||
// Do not start a new task until the previous task has been | ||
// aborted and the shutdown routine has run to completion. | ||
await abortedTaskPromise; | ||
if (outerActiveTask.queued) { | ||
return undefined; | ||
} | ||
// eslint-disable-next-line require-atomic-updates | ||
outerActiveTask = null; | ||
outerActiveTask.queued = true; | ||
try { | ||
// Do not start a new task until the previous task has been | ||
// aborted and the shutdown routine has run to completion. | ||
await outerActiveTask.promise; | ||
} catch { | ||
// nothing to do | ||
} | ||
} else { | ||
@@ -291,3 +302,3 @@ if (trigger.persistent) { | ||
}) // eslint-disable-next-line promise/prefer-await-to-then | ||
.then(() => { | ||
.finally(() => { | ||
if (taskId === outerActiveTask?.id) { | ||
@@ -294,0 +305,0 @@ log.debug('%s (%s): completed task', trigger.name, taskId); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
265120
4553