Skip to content

Commit

Permalink
fix: avoid mem leak
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Mar 26, 2023
1 parent f0271d4 commit a3f6e87
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/fetch/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,12 @@ class Request {
if (signal.aborted) {
ac.abort(signal.reason)
} else {
const weakSelf = new WeakRef(this)
const abort = function () {
ac.abort(this.reason)
const self = weakSelf.deref()
if (self) {
ac.abort(self.reason)
}
}

// Third-party AbortControllers may not work with these.
Expand Down

0 comments on commit a3f6e87

Please sign in to comment.