From 2fc6d30c01a62f29163d251d3aba0b1861e1ce4c Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Mon, 31 Aug 2020 13:38:45 +0200 Subject: [PATCH] Use `os._exit` instead of `sys.exit` - we don't want to raise an exception. --- setup-scripts/funds-checker.py | 5 +++-- setup-scripts/log-checker.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/setup-scripts/funds-checker.py b/setup-scripts/funds-checker.py index 39c31dbb..4e05edd6 100755 --- a/setup-scripts/funds-checker.py +++ b/setup-scripts/funds-checker.py @@ -5,7 +5,7 @@ health-checker runs simple health checks on a portal node using the siad API and dispatches messages to a Discord channel. """ -import discord, traceback, asyncio +import discord, traceback, asyncio, os from bot_utils import setup, send_msg, siad, sc_precision bot_token = setup() @@ -14,7 +14,7 @@ client = discord.Client() async def exit_after(delay): await asyncio.sleep(delay) - exit(0) + os._exit(0) @client.event @@ -75,4 +75,5 @@ async def check_health(): # Send an informational heartbeat if all checks passed. await send_msg(client, "Health checks passed:\n{} \n{}".format(balance_msg, alloc_msg)) + client.run(bot_token) diff --git a/setup-scripts/log-checker.py b/setup-scripts/log-checker.py index ae45e6ef..6d6a32ad 100755 --- a/setup-scripts/log-checker.py +++ b/setup-scripts/log-checker.py @@ -28,7 +28,7 @@ client = discord.Client() # exit_after kills the script if it hasn't exited on its own after `delay` seconds async def exit_after(delay): await asyncio.sleep(delay) - sys.exit(0) + os._exit(0) @client.event