Prevent exceptions from destroying the ELO tracker scheduled loop
parent
6cd1ec9c97
commit
87525238ba
|
|
@ -93,7 +93,7 @@ class RemoteAgent(Agent):
|
||||||
response = requests.get(url, json=payload, timeout=self.timeout)
|
response = requests.get(url, json=payload, timeout=self.timeout)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
content = response.json()
|
content = response.json()
|
||||||
except (requests.RequestException, requests.HTTPError, ValueError):
|
except (requests.ConnectTimeout, requests.RequestException, requests.HTTPError, ValueError):
|
||||||
return {}
|
return {}
|
||||||
else:
|
else:
|
||||||
return content if isinstance(content, dict) else {}
|
return content if isinstance(content, dict) else {}
|
||||||
|
|
|
||||||
|
|
@ -460,7 +460,7 @@ class EloTracker:
|
||||||
self.play_random_match(game=game, player_count=player_count)
|
self.play_random_match(game=game, player_count=player_count)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
self.__debug(f"Scheduled match failed: {exc}")
|
self.__debug(f"Scheduled match failed: {exc}")
|
||||||
raise exc
|
# raise exc
|
||||||
|
|
||||||
if self.__scheduler_stop.wait(interval_seconds):
|
if self.__scheduler_stop.wait(interval_seconds):
|
||||||
break
|
break
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,10 @@ class PyClient:
|
||||||
if on_move is None:
|
if on_move is None:
|
||||||
payload = {}
|
payload = {}
|
||||||
else:
|
else:
|
||||||
payload = on_move(current_state.as_seen_by(player=player))
|
try:
|
||||||
|
payload = on_move(current_state.as_seen_by(player=player))
|
||||||
|
except Exception:
|
||||||
|
payload = {}
|
||||||
|
|
||||||
current_state = current_state.move(payload=payload)
|
current_state = current_state.move(payload=payload)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue