Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/lichess.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def get_challenge_timeout(challenge_response: ChallengeType) -> datetime.timedel
def is_final(exception: Exception) -> bool:
"""If `is_final` returns True then we won't retry."""
return (isinstance(exception, HTTPError) and exception.response is not None and exception.response.status_code < 500
or stop.terminated or stop.force_quit)
or stop.force_quit)


def backoff_handler(details: BackoffDetails) -> None:
Expand Down
7 changes: 2 additions & 5 deletions lib/lichess_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,11 @@ def disable_restart() -> None:

def signal_handler(signal: int, frame: FrameType | None) -> None: # noqa: ARG001
"""Terminate lichess-bot."""
in_starting_thread = __name__ == "__main__"
if not stop.terminated:
if in_starting_thread:
logger.debug("Received SIGINT. Terminating client.")
logger.debug("Received SIGINT. Terminating client.")
stop.terminated = True
else:
if in_starting_thread:
logger.debug("Received second SIGINT. Quitting now.")
logger.debug("Received second SIGINT. Quitting now.")
stop.force_quit = True


Expand Down
Loading