fix messages

This commit is contained in:
notplants 2023-05-01 22:08:22 +05:30
parent a138b92f3a
commit 41c7a5816e
2 changed files with 13 additions and 6 deletions

View File

@ -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 = ""

View File

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