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

Refactor: split global consts for limits #568

Merged

Conversation

josecelano
Copy link
Member

@josecelano josecelano commented Jan 2, 2024

Current const: crate::shared::bit_torrent::common::MAX_SCRAPE_TORRENTS

MAX_SCRAPE_TORRENTS is the limit only for the number of torrents in a scraperequest.

New const: crate::core::TORRENT_PEERS_LIMIT

TORRENT_PEERS_LIMIT is now the limit for the number of peers in an announce request (UDP and HTTP tracker).

Besides, the endpoint to get the torrent details in the API does not limit the number of peers for the torrent. So the API returns all peers in the tracker. This could lead to performance issues and we might need to paginate results, but the API should either return all peers and paginate them in a new endpoint.

Copy link

codecov bot commented Jan 2, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (2099789) 79.31% compared to head (46e67a8) 79.30%.

Files Patch % Lines
src/core/torrent/repository.rs 20.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #568      +/-   ##
===========================================
- Coverage    79.31%   79.30%   -0.02%     
===========================================
  Files          117      117              
  Lines         7785     7736      -49     
===========================================
- Hits          6175     6135      -40     
+ Misses        1610     1601       -9     

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

Current const: `crate::shared::bit_torrent::common::MAX_SCRAPE_TORRENTS`

`MAX_SCRAPE_TORRENTS` is the limit only for the number of torrents in a `scrape`request.

New const: `crate::core::TORRENT_PEERS_LIMIT`

`TORRENT_PEERS_LIMIT` is now the limit for the number of peers in an announce request (UDP and HTTP tracker).

Besides, the endpoint to get the torrent details in the API does not limit the number of peers for the torrent. So the API returns all peers in the tracker. This could lead to performance issues and we might need to paginate results, but the API should either return all peers and paginate them in a new endpoint.
@josecelano
Copy link
Member Author

ACK 46e67a8

@josecelano josecelano merged commit 9826400 into torrust:develop Jan 2, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

MAX_SCRAPE_TORRENTS (74) limit applied to returned peer list in announce request?
1 participant