From 81acebad5cb466eda9eebca1a747ee836c5c4286 Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Wed, 19 Aug 2020 10:25:23 +0300 Subject: [PATCH] Add the forced exit to funds-checker.py as well. --- setup-scripts/funds-checker.py | 9 +++++++-- setup-scripts/log-checker.py | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/setup-scripts/funds-checker.py b/setup-scripts/funds-checker.py index 767d885b..39c31dbb 100755 --- a/setup-scripts/funds-checker.py +++ b/setup-scripts/funds-checker.py @@ -5,17 +5,22 @@ 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)) + asyncio.create_task(exit_after(30)) await client.close() diff --git a/setup-scripts/log-checker.py b/setup-scripts/log-checker.py index cce9a4ad..d4974048 100755 --- a/setup-scripts/log-checker.py +++ b/setup-scripts/log-checker.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 import discord, sys, traceback, io, os, asyncio -from bot_utils import setup, send_msg, sc_precision +from bot_utils import setup, send_msg from datetime import datetime, timedelta from subprocess import Popen, PIPE @@ -33,7 +33,7 @@ async def exit_after(delay): @client.event async def on_ready(): await run_checks() - asyncio.create_task(exit_after(10)) + asyncio.create_task(exit_after(30)) await client.close()