diff --git a/cowmesh_pi_speedtest.py b/cowmesh_pi_speedtest.py index c114188..203a78a 100644 --- a/cowmesh_pi_speedtest.py +++ b/cowmesh_pi_speedtest.py @@ -63,9 +63,16 @@ class CowmeshPiSpeedtestTester: async def run_test(self): for node in nodes: - r = await self.speedtest_node(node) result_key = "{}".format(node) - self.results[result_key] = r + try: + r = await self.speedtest_node(node) + self.results[result_key] = r + except Exception as e: + try: + self.log("error: {}".format(e)) + except: + continue + self.results[result_key] = "error: {}".format(e) async def output_results(self): results_str = "" diff --git a/moonlight_analytics.py b/moonlight_analytics.py index 0351179..62e8cb5 100644 --- a/moonlight_analytics.py +++ b/moonlight_analytics.py @@ -165,7 +165,7 @@ class MoonlightTester: async def send_log(self, bot, chat_id, message_thread_id, log_location): # send log file document = open(log_location, 'rb') - bot.send_document(chat_id, document, message_thread_id=message_thread_id) + await bot.send_document(chat_id, document, message_thread_id=message_thread_id) async def nightly_router_iperf(self, time=10): token = SECRETS["TELEGRAM_TOKEN"] @@ -174,7 +174,7 @@ class MoonlightTester: message_thread_id = SECRETS.get("TELEGRAM_LOG_MESSAGE_THREAD_ID") bot = application.bot - log_name = "moonlight-{:%M-%d-%Y}-{:%H:%m}-router-iperf.txt".format(datetime.today(), datetime.now()) + log_name = "moonlight-{:%m-%d-%Y}-{:%H:%m}-router-iperf.txt".format(datetime.today(), datetime.now()) log_location = os.path.join(LOG_DIR_PATH, log_name) async def offline_log(msg): @@ -204,7 +204,7 @@ class MoonlightTester: bot = application.bot - log_name = "moonlight-{:%M-%d-%Y}-{:%H:%m}-pi-iperf.txt".format(datetime.today(), datetime.now()) + log_name = "moonlight-{:%m-%d-%Y}-{:%H:%m}-pi-iperf.txt".format(datetime.today(), datetime.now()) log_location = os.path.join(LOG_DIR_PATH, log_name) async def offline_log(msg): @@ -233,7 +233,7 @@ class MoonlightTester: message_thread_id = SECRETS.get("TELEGRAM_LOG_MESSAGE_THREAD_ID") bot = application.bot - log_name = "moonlight-{:%M-%d-%Y}-{:%H:%m}-pi-iperf.txt".format(datetime.today(), datetime.now()) + log_name = "moonlight-{:%m-%d-%Y}-{:%H:%m}-pi-speedtest.txt".format(datetime.today(), datetime.now()) log_location = os.path.join(LOG_DIR_PATH, log_name) async def offline_log(msg):