-
Notifications
You must be signed in to change notification settings - Fork 161
fix(rtorrent): auto-detect and use load.throw methods when available #933
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
base: master
Are you sure you want to change the base?
Conversation
|
@copilot Deep dive into https://github.com/rakshasa/rtorrent/blob/master/src/rpc/jsonrpc.cc and related implementations. We should only use load.start / load.normal if .throw versions are not available (JSONRPC_METHOD_NOT_FOUND_ERROR). Do the check only once, however, and no need to do it separately, if one .throw is available assume both are available. |
…ad.normal for URL torrents Co-authored-by: jesec <[email protected]>
|
@copilot and don't commit package-lock.json. We use pnpm. |
Co-authored-by: jesec <[email protected]>
Co-authored-by: jesec <[email protected]>
Implement runtime detection for load.throw/load.start_throw support: - Add detectLoadThrowSupport() to check if .throw methods are available - Cache the result to avoid repeated checks - Prefer .throw methods when available (better error reporting) - Fall back to load.start/load.normal when not available - Check only returns false for JSON-RPC error -32601 (method not found) This allows Flood to work with both upstream rTorrent (with .throw support) and older versions or configurations without .throw methods. Co-authored-by: jesec <[email protected]>
Implemented runtime detection for .throw method support. The code now:
See commit 033a02f
Fixed - package-lock.json was removed and added to .gitignore in commit 0ad4457 |
Problem
Following the fix in commit 082d3e9 (#930) that addressed
load.start_throwusage in file-based torrent addition, the URL-based torrent addition method (addTorrentsByURL) was still using the deprecatedload.start_throwandload.throwcommands. This caused failures when adding torrents via URL from external applications like Sonarr when users removed the stubbed commands from their rTorrent configuration.As reported in 2c5da60#commitcomment-168637106:
Solution
This PR implements runtime detection for
load.throwandload.start_throwmethod availability:Key Implementation:
detectLoadThrowSupport()method that caches the detection resultload.throwavailability and checks for JSON-RPC error -32601 (method not found).throwmethods when available (provides better error reporting)load.start/load.normalwhen.throwmethods are not supportedBefore:
After:
The code now:
.throwmethod support at runtime.throwmethods when available for better error reporting.throwmethods are not availableaddTorrentsByFileandaddTorrentsByURLImpact
This solution provides the best of both worlds:
For users with upstream rTorrent (with
.throwsupport):.throwmethodsFor users with older rTorrent or without
.throwmethods:load.start/load.normalFor all users:
Testing
Fixes #932
Original prompt
load.start_throwis still used #932💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.