Skip to content

Commit 95701b5

Browse files
committed
Make Job.pause bail out early if the cancelation promise resolves
1 parent 9fddfc7 commit 95701b5

File tree

1 file changed

+2
-2
lines changed
  • packages/action-listener-middleware/src

1 file changed

+2
-2
lines changed

packages/action-listener-middleware/src/job.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ export class Job<T> implements JobHandle {
248248
*/
249249
async pause<R>(func: Promise<R>): Promise<R> {
250250
this.ensureActive()
251-
const result = await func
251+
const result = await Promise.race([func, this._cancelPromise])
252252
this.ensureActive()
253-
return result
253+
return result as R
254254
}
255255

256256
/**

0 commit comments

Comments
 (0)