-
Notifications
You must be signed in to change notification settings - Fork 49
Overhaul stats: Simplify how the AnnounceHandler persist number of downloads in tracker-core package
#1531
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
Merged
josecelano
merged 10 commits into
torrust:develop
from
josecelano:1524-overhaul-stats-simplify-how-the-announcehandler-persist-number-of-downloads-in-tracker-core-package
May 26, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ker-core pkg This will enable udpating stats (number of torrent downloads per torrent) from the event handler (persisting in the DB). And after that, I will enable adding lebeled metrics.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1531 +/- ##
===========================================
- Coverage 83.92% 83.88% -0.04%
===========================================
Files 267 270 +3
Lines 19207 19181 -26
Branches 19207 19181 -26
===========================================
- Hits 16119 16090 -29
- Misses 2811 2817 +6
+ Partials 277 274 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…mmand to event handler
AnnounceHandler persist number of downloads in tracker-core packageAnnounceHandler persist number of downloads in tracker-core package
The returned value is not needed anymore. Secondary action (increase metrics) is done in the event listeners.
Member
Author
|
ACK 67d177b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Simplify how the
AnnounceHandlerpersist number of downloads intracker-corepackage.It's now done asynchronously instead of synchronously.
NOTICE: That
bittorrent_tracker_core::announce_handler::AnnounceHandler::announcewill not return a database error anymore, meaning the peer will receive the announce response even if the tracker can't update the downloads counter.Subtasks
Main change:
tracker-corepackage.AnnounceHandlerto the event handler (handle_event).Cleanup:
upsert_peertohandle_announcement.AnnounceHandler::announcetoAnnounceHandler::handle_announcementnumber of downloads increasedinupsert_peer.upsert_peershould only be a command decoupled from other secondary tasks. Side effects should be captured from events.NOTE: I cannot remove the
db_torrent_repositorydependency from theAnnounceHandleryet until we implement the new persistent metric for the number of downloads, because it's still used in: