Skip to content

Refactor: split global consts for limits#568

Merged
josecelano merged 1 commit intotorrust:developfrom
josecelano:issue-262-refactor-global-constants
Jan 2, 2024
Merged

Refactor: split global consts for limits#568
josecelano merged 1 commit intotorrust:developfrom
josecelano:issue-262-refactor-global-constants

Conversation

@josecelano
Copy link
Copy Markdown
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.

@codecov
Copy link
Copy Markdown

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 josecelano force-pushed the issue-262-refactor-global-constants branch from db6258b to 46e67a8 Compare January 2, 2024 14:50
@josecelano
Copy link
Copy Markdown
Member Author

ACK 46e67a8

@josecelano josecelano merged commit 9826400 into torrust:develop Jan 2, 2024
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