Skip to content

Commit

Permalink
fix(storage-client): nodejs memory leak issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AliMD committed Nov 19, 2022
1 parent 859cc21 commit d5e0cde
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 4 additions & 6 deletions packages/core/storage-client/src/storage-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ export class AlwatrStorageClient<DocumentType extends DocumentObject> {
*/
fetchOption: Partial<FetchOptions> = {
keepalive: true,
timeout: this.config.timeout ?? 3_000,
timeout: this.config.timeout ?? 0,
cacheStrategy: 'network_only',
removeDuplicate: 'never',
retry: 3,
retryDelay: 300,
headers: {
Expand Down Expand Up @@ -185,11 +187,7 @@ export class AlwatrStorageClient<DocumentType extends DocumentObject> {
queryParameters: {
storage: this.config.name,
},
headers: {
...this.fetchOption.headers,
'Content-Type': 'application/json',
},
body: JSON.stringify(documentObject),
bodyJson: documentObject,
});

let content: ServerResponse<DocumentType>;
Expand Down
4 changes: 3 additions & 1 deletion packages/core/storage-client/src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export type AlwatrStorageClientConfig = {
/**
* A timeout in ms for the fetch request.
*
* @default 10_000 ms
* Use with cation, you will have memory leak issue in nodejs.
*
* @default 0 disabled
*/
timeout?: number;

Expand Down

0 comments on commit d5e0cde

Please sign in to comment.