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

Improve resource management for network sessions #340

Merged
merged 3 commits into from
Mar 8, 2021

Conversation

samschott
Copy link
Owner

This PR introduces manual scoping of network sessions.

This is used to create a new network session and clean up its resources for:

  1. Individual upload or download threads from our thread pool.
  2. Entire upload or download sync cycles.
  3. Main API calls that may use significant network resources.

This improves memory usage for long running daemons by more frequently and immediately cleaning up network resources. It may also work around a memory issue with requests when used in threads, see psf/requests#4601 (comment).

@codecov
Copy link

codecov bot commented Mar 8, 2021

Codecov Report

Merging #340 (e395205) into master (acf6d4f) will increase coverage by 0.12%.
The diff coverage is 88.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #340      +/-   ##
==========================================
+ Coverage   72.07%   72.19%   +0.12%     
==========================================
  Files          30       30              
  Lines        6324     6363      +39     
==========================================
+ Hits         4558     4594      +36     
- Misses       1766     1769       +3     
Flag Coverage Δ
pytest 72.19% <88.72%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/maestral/main.py 64.10% <28.57%> (-0.30%) ⬇️
src/maestral/sync.py 84.57% <95.09%> (+0.21%) ⬆️
src/maestral/client.py 56.74% <100.00%> (+0.87%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update acf6d4f...e395205. Read the comment docs.

@samschott samschott merged commit 0d1d4db into master Mar 8, 2021
@samschott samschott deleted the requests-memory-management branch March 8, 2021 14:21
@samschott
Copy link
Owner Author

See #248.

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

1 participant