Closed rva87 closed 6 years ago
@rva87 Thanks for the PR. Quick question: is there a functional difference between having this loop of 3 and 22 vs simply bumping the timeout to 25?
---Alex
@aqw With this setup the user will not notice there was a timeout if the retry is successful. If you only have a single timeout at 25 seconds there will be no retry and the user will still see the generic error (at least for now). Normally i wouldn't expect any server to need this long to respond anyway so it might be safe to pick lower values. However i'm not sure how fast the NFL servers will be during the season hence the "high" timeouts.
By the way, open actions should still be (longer term):
@rva87 Thanks for the patch and explanation. As FYI, I have finally created aqw/pigskin and merged the patch there. I've imported the latest version here, so this addon now has the fixes as well.
Thanks!
Timeout setting and retry for requests.
To reproduce, open the addon. Go to games overview, wait a couple of minutes, click on any of the weeks.
Before patch, it takes minutes before the addon responds with an error. In the logs: 23:16:55.201 T:1752556448 DEBUG: [plugin.video.nfl.gamepass-0.11.2-dev]: Traceback (most recent call last): File "/storage/.kodi/addons/plugin.video.nfl.gamepass/default.py", line 500, in onClick self.display_shows_episodes(show_name, self.selected_season) File "/storage/.kodi/addons/plugin.video.nfl.gamepass/default.py", line 234, in display_shows_episodes episodes = gp.get_shows_episodes(show_name, season) File "/storage/.kodi/addons/plugin.video.nfl.gamepass/resources/lib/pigskin.py", line 425, in get_shows_episodes programs = self.make_request(url, 'get')['modules']['programs'] File "/storage/.kodi/addons/plugin.video.nfl.gamepass/resources/lib/pigskin.py", line 78, in make_request req = self.http_session.get(url, params=params, headers=headers, timeout=10) File "/storage/.kodi/addons/script.module.requests/lib/requests/sessions.py", line 521, in get return self.request('GET', url, kwargs) File "/storage/.kodi/addons/script.module.requests/lib/requests/sessions.py", line 508, in request resp = self.send(prep, send_kwargs) File "/storage/.kodi/addons/script.module.requests/lib/requests/sessions.py", line 618, in send r = adapter.send(request, **kwargs) File "/storage/.kodi/addons/script.module.requests/lib/requests/adapters.py", line 521, in send raise ReadTimeout(e, request=request) ReadTimeout: HTTPSConnectionPool(host='www.nflgamepass.com', port=443): Read timed out. (read timeout=10)
After patch, the addon is busy for a couple of seconds and updates the data as expected: 23:50:37.309 T:1744167840 DEBUG: [pigskin]: Request URL: https://www.nflgamepass.com/api/en/content/v1/web/games/2018/pre/1/list 23:50:37.310 T:1744167840 DEBUG: [pigskin]: Method: get 23:50:37.375 T:1786770336 DEBUG: PushCecKeypress - received key b duration 192 (rep:0 size:0) 23:50:37.376 T:1786770336 DEBUG: PushCecKeypress - ignored key b 23:50:40.366 T:1744167840 DEBUG: [pigskin]: Timeout condition occured after 3 seconds 23:50:40.623 T:1744167840 DEBUG: [pigskin]: Response code: 200