Skip to content

Commit d62b2d7

Browse files
Simon-Lauxlink2xt
authored andcommitted
fix memory leak in ts client.
Old Promises including their return values were not garbage collected, because they were not removed from the `_requests` Map. fixes #60
1 parent 7d3b017 commit d62b2d7

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

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

5+
## Unreleased
6+
7+
- ts client: fix memory leak
8+
59
## 0.5.3 - 2023-12-02
610

711
- Update axum

typescript/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export abstract class BaseTransport<T = {}>
3838
if (!response.id) return; // TODO: Handle error.
3939
const handler = this._requests.get(response.id);
4040
if (!handler) return; // TODO: Handle error.
41+
this._requests.delete(response.id)
4142
if (response.error) handler.reject(response.error);
4243
else handler.resolve(response.result);
4344
}

0 commit comments

Comments
 (0)