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: Fix Memory Leaks & other minor fixes #15

Merged
merged 22 commits into from
Jan 8, 2025
Merged

fix: Fix Memory Leaks & other minor fixes #15

merged 22 commits into from
Jan 8, 2025

Conversation

binaryoverload
Copy link
Member

@binaryoverload binaryoverload commented Jan 7, 2025

Resolves the memory leak! Leaving this in draft for ~24 hours while I test on prod to ensure it's fixed

Credit to @TortleWortle for initially figuring out the quirk with .pipe

Changes:

  • Added @smithy/types to correctly type the S3 client so we don't have to weirdly cast things
  • Use Stream.pipeline to fix the memory leak with S3 requests staying in memory if the NPDL request isn't closed nicely
  • Removed all sync IO in HTTP requests and replaced with call backs to reduce blocking
  • Update dependencies and fix some automatically fixable linting issues
  • Update logger to properly pad time and have date (For tracking down errors)
  • Fix typo in Content-Type header

@binaryoverload binaryoverload self-assigned this Jan 7, 2025
@DaniElectra
Copy link
Member

Actually nevermind, looks like the applicatoin typo is actually intended and is what the official server sets. Can you revert back that and add a comment about it being intended?

imagen

@binaryoverload binaryoverload marked this pull request as ready for review January 7, 2025 22:21
Copy link
Member

@jonbarrow jonbarrow left a comment

Choose a reason for hiding this comment

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

Overall the actual functionality changes look great 👍 many thanks for finding this! Review is almost entirely nits for styling reasons (as discussed on Discord this is not your fault, we don't have this posted anywhere) and a couple questions

(some things apply to the whole PR, though I've only commented once)

src/logger.ts Outdated Show resolved Hide resolved
src/services/npdi.ts Outdated Show resolved Hide resolved
src/services/npdi.ts Outdated Show resolved Hide resolved
src/types/mongoose/cec-data.ts Outdated Show resolved Hide resolved
src/util.ts Outdated Show resolved Hide resolved
src/util.ts Show resolved Hide resolved
@binaryoverload binaryoverload marked this pull request as draft January 8, 2025 14:19
@binaryoverload binaryoverload marked this pull request as ready for review January 8, 2025 16:30
Copy link
Member

@jonbarrow jonbarrow left a comment

Choose a reason for hiding this comment

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

Gorgeous, only one question and that's it

src/middleware/authentication.ts Outdated Show resolved Hide resolved
@jonbarrow
Copy link
Member

LGTM! Great work!

@jonbarrow jonbarrow merged commit 644081e into dev Jan 8, 2025
3 checks passed
@binaryoverload binaryoverload deleted the memory-fixes branch January 8, 2025 19:40
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.

3 participants