Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory-leak on fetch #252

Merged
merged 1 commit into from
Feb 27, 2024

Conversation

timursevimli
Copy link
Member

https://undici.nodejs.org/#/?id=garbage-collection

  • tests and linter show no problems (npm t)
  • tests are added/updated for bug fixes and new features
  • code is properly formatted (npm run fmt)
  • description of changes is added in CHANGELOG.md
  • update .d.ts typings

@@ -41,6 +41,7 @@ const httpApiCall = async (url, { method = 'POST', headers = {}, body }) => {
return await fetch(url, options).then(async (res) => {
const code = res.status;
if (code === 200) return await res.json();
await res.body.cancel();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively can be used:

for await (const _ of res.body) { }

@tshemsedinov tshemsedinov merged commit 25ee8f9 into metarhia:master Feb 27, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants