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

Chunked downloads #373

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

codemonium
Copy link
Contributor

@codemonium codemonium commented Jan 4, 2023

Before this change, whenever the user would download an attachment, the client (Pantalaimon) would store all the data in memory while processing it. This causes significant memory usage spikes when downloading multiple large files at once. The high memory usage is a major problem when running Pantalaimon in a memory-constrained setting.

This change adds a function for lazily decrypting files (an analogue to the one for lazily encrypting files, which already exists), and a new client function for using the chunked data.

See also matrix-org/pantalaimon#149

Before this change, whenever the user would download an attachment, the
client (Pantalaimon) would store all the data in memory while processing
it. This causes significant memory usage spikes when downloading
multiple large files at once. The high memory usage is a major problem
when running Pantalaimon in a memory-constrained setting.

This change adds a function for lazily decrypting files (an analogue to
the one for lazily encrypting files, which already exists), and a new
client function for using the chunked data.
@thebalaa
Copy link

@PaarthShah why no movement on this?

@PaarthShah
Copy link
Collaborator

@PaarthShah why no movement on this?

Mainly just that this PR was from before I became a maintainer and I'd not been keeping track of it :^)

Adding myself for review for later

Copy link
Collaborator

@PaarthShah PaarthShah Jul 18, 2023

Choose a reason for hiding this comment

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

After reviewing this, I think the only real change that's required is that we need to preserve the non-streaming versions of these tests; other than that, things look quite good to me!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do the existing attachment_test.py tests suffice? I don't quite remember, but that might be why I simply replaced the tests in this file instead of creating a new one.

Choose a reason for hiding this comment

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

@PaarthShah This question here.

@chookity-pokk
Copy link

Just curious if I could help this get merged by chance?

@PaarthShah
Copy link
Collaborator

Just curious if I could help this get merged by chance?

@chookity-pokk by all means; if you want to fork/resubmit the PR, go for it

Copy link

codecov bot commented Jun 6, 2024

Codecov Report

Attention: Patch coverage is 78.84615% with 11 lines in your changes missing coverage. Please review.

Project coverage is 89.64%. Comparing base (e01d0db) to head (b1f9524).

Files Patch % Lines
nio/client/async_client.py 33.33% 6 Missing ⚠️
nio/responses.py 66.66% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #373       /-   ##
==========================================
- Coverage   89.71%   89.64%   -0.07%     
==========================================
  Files          42       42              
  Lines        8090     8142       52     
==========================================
  Hits         7258     7299       41     
- Misses        832      843       11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@chookity-pokk
Copy link

@PaarthShah Sweet, sounds good. Would you mind just responding to @codemonium's question above about test coverage?

@PaarthShah
Copy link
Collaborator

@chookity-pokk I'm not sure I see what the question is (did you mean the post by the bot?): can you link it?

@nexy7574
Copy link
Contributor

@ chookity-pokk I'm not sure I see what the question is (did you mean the post by the bot?): can you link it?

I believe it was in reply to this discussion: #373 (comment)

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.

5 participants