Merge pull request #132523 from AkatQuas/fix/runner

fix: early return on cancellation
This commit is contained in:
Martin Aeschlimann 2021-09-09 09:42:04 +02:00 committed by GitHub
commit 8af5d85c3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 0 deletions

View file

@ -23,6 +23,7 @@ export function runSafeAsync<T>(runtime: RuntimeEnvironment, func: () => Thenabl
runtime.timer.setImmediate(() => {
if (token.isCancellationRequested) {
resolve(cancelValue());
return;
}
return func().then(result => {
if (token.isCancellationRequested) {

View file

@ -23,6 +23,7 @@ export function runSafe<T>(runtime: RuntimeEnvironment, func: () => Thenable<T>,
runtime.timer.setImmediate(() => {
if (token.isCancellationRequested) {
resolve(cancelValue());
return;
}
return func().then(result => {
if (token.isCancellationRequested) {

View file

@ -23,6 +23,7 @@ export function runSafeAsync<T>(runtime: RuntimeEnvironment, func: () => Thenabl
runtime.timer.setImmediate(() => {
if (token.isCancellationRequested) {
resolve(cancelValue());
return;
}
return func().then(result => {
if (token.isCancellationRequested) {