[NEEDS CODE REVIEWER] Handle failed /sync/maindata requests in check_connected#342
[NEEDS CODE REVIEWER] Handle failed /sync/maindata requests in check_connected#342jamtur01 wants to merge 2 commits into
Conversation
Previously, an HTTP error from the qBit API (e.g. a 500 from rdt-client) would crash decluttarr entirely. Now the error is caught and treated as a disconnected client, so the cycle is skipped and retried next run.
|
hi, I am truly sorry I haven't looked into your PR in such a long time. I do appreciate very much that you took the time to contribute. Unfortunately, I don't have the time to look into it still. Would you be willing to act as a formal contributor? If yes, I will add you, and if I find others (from open PRs), hopefully you can review each others PR and they can be merged. Thanks for letting me know, and apologies again for my radio silence. |
|
Hey @jamtur01, Thanks for contributing! I am going through the open PRs with @ManiMatter to clear the backlog. Fix is clean and scoped: Ask — issue reference: Heads-up — relationship to #333: Otherwise all checks out! |
lolimmlost
left a comment
There was a problem hiding this comment.
Took it for a spin — fix holds up. Approving.
Smoke tested all four paths against check_connected:
- ✅ HTTPError (500) → returns
False, warning logged, no crash - ✅ Connected status → returns
True - ✅ Disconnected status → returns
False - ✅ Malformed/missing
server_state→ returnsFalse(broadexcept Exceptioncatches theKeyErrorcleanly)
Full test suite passes (192/192).
Follow-up worth flagging (not blocking this PR):
SABnzbd's check_connected in _download_clients_sabnzbd.py:122 has the same unguarded pattern — make_request + response.json() + dict access, no try/except. A 500 from SAB will crash decluttarr the same way. Happy to open a follow-up PR mirroring this fix once #342 lands so the diffs stay easy to review.
LGTM.
Previously, an HTTP error from the qBit API (e.g. a 500 from rdt-client) would crash decluttarr entirely. Now the error is caught and treated as a disconnected client, so the cycle is skipped and retried next run.
Here's an example of what happens:
This closes #348