fix(discogs): retry malformed search responses - #6912
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6912 +/- ##
==========================================
+ Coverage 75.74% 75.77% +0.03%
==========================================
Files 164 164
Lines 21437 21443 +6
Branches 3379 3379
==========================================
+ Hits 16237 16248 +11
+ Misses 4400 4396 -4
+ Partials 800 799 -1
🚀 New features to boost your workflow:
|
15359b3 to
afd07ce
Compare
|
This seems like something to me that could be part of the |
|
The code for this PR looks good to me! I think my question is whether immediately retrying a query immediately after a failure seems to actually yield results after a json.decode() error. If it's an outage on the discogs server side, my instinct is that it won't fix it, but I could be totally wrong if anyone has anecdotal experience with this issue. It's also hard to test if a re-search actuallr recovers errors from discogs since it seems to be a white whale issue - none of this is to say we shouldn't try to give a query another shot in a failure. EDIT: Well, anecdotally - it seems to resolve it according to this post: joalla/discogs_client#163 (comment) |
henry-oberholtzer
left a comment
There was a problem hiding this comment.
Looks simple enough. I'll let another maintainer just re-confirm since I've been away from the project for a minute. :)
My anecdotal experience is also that a retry returns success, but that's usually after at least a few seconds following an abort and restart of the current import. We may find success to be less likely when immediately retried. I added a log line indicating the retry so that we can later evaluate if a small sleep between attempts may increase the chance of success. |
I can definitely appreciate this take. I considered that approach as well, but given the discussion and apparent ambiguity in joalla/discogs_client#163, I thought this one small effort upstream could protect the user experience while Still, I completely understand if this is desired downstream instead. Thanks for your consideration! |
Summary
Retry Discogs searches once when the API returns an invalid JSON response. If the retry also fails, flow through existing error handling. Includes regression tests for successful recovery and retry exhaustion.
Reference: joalla/discogs_client#163
Originating stack trace:
Testing
To Do
Documentation. (If you've added a new command-line flag, for example, find the appropriate page underdocs/to describe it.)docs/changelog.rstto the bottom of one of the lists near the top of the document.)