Use `os._exit` instead of `sys.exit` - we don't want to raise an exception.
This commit is contained in:
parent
8761a77e18
commit
2fc6d30c01
|
@ -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.
|
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
|
from bot_utils import setup, send_msg, siad, sc_precision
|
||||||
|
|
||||||
bot_token = setup()
|
bot_token = setup()
|
||||||
|
@ -14,7 +14,7 @@ client = discord.Client()
|
||||||
|
|
||||||
async def exit_after(delay):
|
async def exit_after(delay):
|
||||||
await asyncio.sleep(delay)
|
await asyncio.sleep(delay)
|
||||||
exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
|
@ -75,4 +75,5 @@ async def check_health():
|
||||||
# Send an informational heartbeat if all checks passed.
|
# Send an informational heartbeat if all checks passed.
|
||||||
await send_msg(client, "Health checks passed:\n{} \n{}".format(balance_msg, alloc_msg))
|
await send_msg(client, "Health checks passed:\n{} \n{}".format(balance_msg, alloc_msg))
|
||||||
|
|
||||||
|
|
||||||
client.run(bot_token)
|
client.run(bot_token)
|
||||||
|
|
|
@ -28,7 +28,7 @@ client = discord.Client()
|
||||||
# exit_after kills the script if it hasn't exited on its own after `delay` seconds
|
# exit_after kills the script if it hasn't exited on its own after `delay` seconds
|
||||||
async def exit_after(delay):
|
async def exit_after(delay):
|
||||||
await asyncio.sleep(delay)
|
await asyncio.sleep(delay)
|
||||||
sys.exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
|
|
Reference in New Issue