yahoo-fantasy-sports-api: retry mechanism / better error handling
Not sure if yahoo is just being flakey tonight, but I was running into an issue where some calls were randomly failing with a 500 error (no response body). Successive calls would succeed, however.
When yahoo returns a 500 and there is no response body, then nothing gets parsed as data and this line fails actually
Locally, I solved my issue by dropping in requestretry, which by default will retry on 500 errors up to 5 times, with a delay in between.
Any thoughts on adopting that approach as well? Or at least inspecting the response statusCode and invoking the api callback with an (appropriate) error when data is undefined (and then users could simply implement their own retry logic.)
About this issue
- Original URL
- State: open
- Created 8 years ago
- Comments: 16 (8 by maintainers)
Thanks, everyone!
@whatadewitt - that would be a huge help to me. I want to play by the rules, but they just haven’t published them…
@Liam-OShea - your comment there is really helpful. I’m going to respond in that thread.
@coolsoftwaretyler I’ll reach out to the guy at Yahoo! who helps with these sorts of things. I’ll let you know!
I’ve had 999 when I first started building this thing…
I will play around and see if I can get the 500, but I’m going to try to fix the players.leagues call now, then I’ll probably push a v3.0.0 that will change that to players.league, as all of the subresource calls only (really) matter within the league context…
After that maybe we can try to figure out if we can hookup the 500 error, but I am confident that simply having this thing work better according to the docs, that it could help resolve the problem (but maybe that’s just because I’m a wishful thinker)