Skip to content

Commit

Permalink
fix memory leak in ts client.
Browse files Browse the repository at this point in the history
Old Promises including their return values were not garbage collected, because they were not removed from the `_requests` Map.

fixes #60
  • Loading branch information
Simon-Laux authored and link2xt committed Jul 6, 2024
1 parent 7d3b017 commit d62b2d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## Unreleased

- ts client: fix memory leak

## 0.5.3 - 2023-12-02

- Update axum
Expand Down
1 change: 1 addition & 0 deletions typescript/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export abstract class BaseTransport<T = {}>
if (!response.id) return; // TODO: Handle error.
const handler = this._requests.get(response.id);
if (!handler) return; // TODO: Handle error.
this._requests.delete(response.id)
if (response.error) handler.reject(response.error);
else handler.resolve(response.result);
}
Expand Down

0 comments on commit d62b2d7

Please sign in to comment.