Give the client 10 seconds to properly exits and if it fails to do so `exit` the hard way.
This commit is contained in:
parent
4b7f80c3b4
commit
221902508f
|
@ -5,15 +5,21 @@ health-checker runs simple health checks on a portal node using the siad API and
|
|||
dispatches messages to a Discord channel.
|
||||
"""
|
||||
|
||||
import discord, traceback
|
||||
import discord, traceback, asyncio
|
||||
from bot_utils import setup, send_msg, siad, sc_precision
|
||||
|
||||
bot_token = setup()
|
||||
client = discord.Client()
|
||||
|
||||
async def exit_after(delay):
|
||||
await asyncio.sleep(delay)
|
||||
exit(0)
|
||||
|
||||
|
||||
@client.event
|
||||
async def on_ready():
|
||||
await run_checks()
|
||||
asyncio.create_task(exit_after(10))
|
||||
await client.close()
|
||||
|
||||
|
||||
|
|
Reference in New Issue