Skip to content

Commit

Permalink
fix forwarded cancel of child to be inftly recursive
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianMairinger committed Jan 21, 2024
1 parent 72c95bd commit c91df66
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions app/src/moreProms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,16 +404,17 @@ function mkExt(Prom: typeof Promise) {
super(executor)


this.cancel = memoize((reason: C) => {
this.cancel = memoize((reason) => {
if (this.settled) return
(this as any).cancelReason = reason
for (const f of this.nestedCancels) f(reason)
this.res = () => {}
this.rej = () => {}
this.cancelled = true;
const cancelResult = this.cancelFunc !== undefined ? this.cancelFunc(reason) : undefined
this.onCancel.res({reason, cancelResult})
return cancelResult
}, (reason) => {
for (const f of this.nestedCancels) f(reason)
})
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"dependencies": {
"colorful-cli-logger": "^1.0.0",
"commander": "^10.0.1",
"key-index": "^1.4.18",
"key-index": "^1.7.0",
"req-package-json": "^2.1.2"
}
}

0 comments on commit c91df66

Please sign in to comment.