From 19fff428cd9e2d0df7fffe67e94b82b4a7f3d6f0 Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Wed, 19 Aug 2020 10:17:26 +0300 Subject: [PATCH] Move code to the right place. --- setup-scripts/funds-checker.py | 6 +----- setup-scripts/log-checker.py | 9 ++++++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/setup-scripts/funds-checker.py b/setup-scripts/funds-checker.py index 2f840538..767d885b 100755 --- a/setup-scripts/funds-checker.py +++ b/setup-scripts/funds-checker.py @@ -5,16 +5,12 @@ 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 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(): diff --git a/setup-scripts/log-checker.py b/setup-scripts/log-checker.py index fdbcd250..cce9a4ad 100755 --- a/setup-scripts/log-checker.py +++ b/setup-scripts/log-checker.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -import discord, sys, traceback, io, os +import discord, sys, traceback, io, os, asyncio from bot_utils import setup, send_msg, sc_precision from datetime import datetime, timedelta from subprocess import Popen, PIPE @@ -24,9 +24,16 @@ DEFAULT_CHECK_INTERVAL = 1 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()