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.raise_for_status()
|
||||
content = response.json()
|
||||
except (requests.RequestException, requests.HTTPError, ValueError):
|
||||
except (requests.ConnectTimeout, requests.RequestException, requests.HTTPError, ValueError):
|
||||
return {}
|
||||
else:
|
||||
return content if isinstance(content, dict) else {}
|
||||
|
|
|
|||
|
|
@ -460,7 +460,7 @@ class EloTracker:
|
|||
self.play_random_match(game=game, player_count=player_count)
|
||||
except Exception as exc:
|
||||
self.__debug(f"Scheduled match failed: {exc}")
|
||||
raise exc
|
||||
# raise exc
|
||||
|
||||
if self.__scheduler_stop.wait(interval_seconds):
|
||||
break
|
||||
|
|
|
|||
|
|
@ -52,7 +52,10 @@ class PyClient:
|
|||
if on_move is None:
|
||||
payload = {}
|
||||
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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue