-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
WebAPI: optionally include trackers list in torrent info response #22128
WebAPI: optionally include trackers list in torrent info response #22128
Conversation
These aren't real trackers. Does it make sense in the output of this API endpoint? |
Not that I can think of. Only the real trackers are useful. Ok to remove then? 👍 |
@zze0s |
@zze0s thanks for the contribution! Tremendously useful to avoid fetching all trackers by every torrent hash 👌👌 |
This is another optimization for torrent management on large scale instances with the goal to minimize the amount of required API calls. Ref #22128. This new function and endpoint torrents/setTags does an upsert to replace the torrent tags and handles the removal and add internally, instead of doing multiple calls to add and remove tags on torrents from the client. PR #22156. --------- Co-authored-by: Chocobo1 <[email protected]> Co-authored-by: Vladimir Golovnev <[email protected]>
@CarlosLanderas ❤️ once this and #22156 lands in new versions and tools/libraries are updated it will make a huge difference for big instances! 🥳 |
This PR adds an optional parameter
includeTrackers
to the Torrent info endpoint/torrents/info
to include the trackers list of each torrent in the response under the keytrackers
.Why?
Me and a lot of other users runs anything between 1-40k torrents in a single instance and we rely on various tools to do things like tag by different tracker states.
To get the trackers we have to first get the list of torrents and then loop through that to get the trackers per torrent. With 10k torrents that's 10000+1 requests towards qBitorrent. It does handle it fairly well but it feels a bit wrong to spam it like that.
With this change we'll be able to get all that info in a single call (or few calls with pagination). It will most likely reduce the overall load quite a bit.
About the code
This is my first time touching c++ and making any changes to this codebase but I read the contributing guidelines etc so it should be to spec.
Not sure if
KEY_PROP_TRACKERS
is the correct one to set or if it should beTORRENT_
something instead.I just copied the
private
bool param so it behaves the same but it could potentially be changed toincludes=trackers,other
which takes a comma separated string of other things that could be of interest to include.The trackers logic is just a copy paste from the getTrackers endpoint. Not sure if
getStickyTrackers()
should be included or not.I tested it locally and it works as expected with and without the new
includeTrackers
query param.