khazhyk / osuapi

Simple osu api wrapper that I can use with both requests and aiohttp
http://osuapi.readthedocs.io/en/latest/index.html
MIT License
16 stars 8 forks source link

Randoms HTTP errors : 504 Gateway timeout #9

Closed Renondedju closed 7 years ago

Renondedju commented 7 years ago

Whatever i'm doing, there is no way to fix thoses errors ...

Traceback (most recent call last): File "/usr/local/lib/python3.5/site-packages/discord/client.py", line 307, in _run_event yield from getattr(self, event)(*args, **kwargs) File "UsoDiscord.py", line 325, in on_ready update_stats.update_all_stats(conn, cursor) File "/root/UsoBot/update_stats.py", line 107, in update_all_stats update_stats(0, conn, api, osuId = osu_id[0]) File "/root/UsoBot/update_stats.py", line 51, in update_stats apiResults = api.get_user_best(osuId, limit = scores) File "/usr/local/lib/python3.5/site-packages/osuapi-0.0.15-py3.5.egg/osuapi/osu.py", line 71, in get_user_best ), JsonList(SoloScore)) File "/usr/local/lib/python3.5/site-packages/osuapi-0.0.15-py3.5.egg/osuapi/osu.py", line 34, in _make_req return self.connector.processrequest(endpoint, {k: v for k, v in data.items() if v is not None}, type) File "/usr/local/lib/python3.5/site-packages/osuapi-0.0.15-py3.5.egg/osuapi/connectors.py", line 77, in process_request raise HTTPError(resp.status_code, resp.reason, resp.text) osuapi.errors.HTTPError: (504, 'Gateway Time-out',

khazhyk commented 7 years ago

This error means that the osu api is down/not responding.

I was thinking of adding some retry logic, since this can be annoying. Not how often retrying on 504 is successful or not, but worth a shot.

khazhyk commented 7 years ago

Testing a change for this on my bot, which sees 504s 2-4 times a day on average, then I'll push a release.

khazhyk commented 7 years ago

Added in 0.0.19, we will now retry up to 5 times (by default) when we get 504.