eniklas / gamatrix

Inspect GOG DBs and report the games in common between them
Mozilla Public License 2.0
11 stars 3 forks source link

Long timeout when IGDB is unavailable #90

Open eniklas opened 2 years ago

eniklas commented 2 years ago

We uploaded a new DB and IGDB happened to be unavailable when we ran gamatrix:

Nov 07 21:17:48 batty 75e0f465caf1[1777]: 2021-11-07 21:17:48 INFO helpers.igdb_helper xboxone_1794566092: getting ID from IGDB
Nov 07 21:18:00 batty 75e0f465caf1[1777]: 2021-11-07 21:18:00 ERROR helpers.igdb_helper Request to IGDB failed: HTTPSConnectionPool(host='api.igdb.com', port=443): Max retries exceeded with url: /v4/external_games (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fd0b61d9bb0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
Nov 07 21:18:00 batty 75e0f465caf1[1777]: 2021-11-07 21:18:00 INFO helpers.igdb_helper 1 API failures, sleeping 2
Nov 07 21:18:08 batty 75e0f465caf1[1777]: 2021-11-07 21:18:08 ERROR helpers.igdb_helper Request to IGDB failed: HTTPSConnectionPool(host='api.igdb.com', port=443): Max retries exceeded with url: /v4/external_games (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fd0b5cddd90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
Nov 07 21:18:08 batty 75e0f465caf1[1777]: 2021-11-07 21:18:08 INFO helpers.igdb_helper 2 API failures, sleeping 4
Nov 07 21:18:22 batty 75e0f465caf1[1777]: 2021-11-07 21:18:22 ERROR helpers.igdb_helper Request to IGDB failed: HTTPSConnectionPool(host='api.igdb.com', port=443): Max retries exceeded with url: /v4/games (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fd0b473ab80>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
...
Nov 07 21:20:08 batty 75e0f465caf1[1777]: 2021-11-07 21:20:08 INFO helpers.igdb_helper 10 API failures, sleeping 20
...
Nov 07 21:36:30 batty 75e0f465caf1[1777]: 2021-11-07 21:36:30 ERROR werkzeug Error on request:
Nov 07 21:36:30 batty 75e0f465caf1[1777]: Traceback (most recent call last):
Nov 07 21:36:30 batty 75e0f465caf1[1777]:   File "/usr/local/lib/python3.9/site-packages/werkzeug/serving.py", line 319, in run_wsgi
Nov 07 21:36:30 batty 75e0f465caf1[1777]:     execute(self.server.app)
Nov 07 21:36:30 batty 75e0f465caf1[1777]:   File "/usr/local/lib/python3.9/site-packages/werkzeug/serving.py", line 311, in execute
Nov 07 21:36:30 batty 75e0f465caf1[1777]:     write(data)
Nov 07 21:36:30 batty 75e0f465caf1[1777]:   File "/usr/local/lib/python3.9/site-packages/werkzeug/serving.py", line 290, in write
Nov 07 21:36:30 batty 75e0f465caf1[1777]:     self.wfile.write(data)
Nov 07 21:36:30 batty 75e0f465caf1[1777]:   File "/usr/local/lib/python3.9/socketserver.py", line 799, in write
Nov 07 21:36:30 batty 75e0f465caf1[1777]:     self._sock.sendall(b)
Nov 07 21:36:30 batty 75e0f465caf1[1777]: TimeoutError: [Errno 110] Connection timed out

From the user perspective it just hangs for 20 minutes; it will try every request, taking longer each time due to the backoff, until the connection times out. Update it to give up after, say, 3 failures. When this happens, add a warning to the results page that it happened.