Give the client 10 seconds to properly exits and if it fails to do so `exit` the hard way.

This commit is contained in:
Ivaylo Novakov 2020-08-18 18:25:54 +03:00
parent 4b7f80c3b4
commit 221902508f
No known key found for this signature in database
GPG Key ID: 06B9354AB08BE9C6
1 changed files with 7 additions and 1 deletions

View File

@ -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()