aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2023-03-17 20:24:44 +0000
committerterminaldweller <thabogre@gmail.com>2023-03-17 20:24:44 +0000
commitf82c6bfd7f67f80e75d79391a5db53dc90a7bc70 (patch)
tree442862e795fb0b289b46df344e15a04b47138610
parentadded the new auto_start option to the readme (diff)
downloadtunneltop-f82c6bfd7f67f80e75d79391a5db53dc90a7bc70.tar.gz
tunneltop-f82c6bfd7f67f80e75d79391a5db53dc90a7bc70.zip
fixed the bug where we were not removing cancelled tests
Diffstat (limited to '')
-rw-r--r--pyproject.toml2
-rwxr-xr-xtunneltop/tunneltop.py11
2 files changed, 9 insertions, 4 deletions
diff --git a/pyproject.toml b/pyproject.toml
index 44270e7..56fed43 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "tunneltop"
-version = "0.4.0"
+version = "0.4.1"
description = "A top-like tunnel manager"
authors = ["terminaldweller <devi@terminaldweller.com>"]
license = "GPL-3.0"
diff --git a/tunneltop/tunneltop.py b/tunneltop/tunneltop.py
index f9e734b..01f1bf3 100755
--- a/tunneltop/tunneltop.py
+++ b/tunneltop/tunneltop.py
@@ -4,6 +4,7 @@ import argparse
import asyncio
import copy
import curses
+import datetime
import enum
import os
import signal
@@ -445,7 +446,7 @@ class TunnelManager:
"a",
encoding="utf-8",
) as logfile:
- logfile.write(log)
+ logfile.write(repr(datetime.datetime.now()) + ": " + log)
async def restart_task(self, line_content: str) -> None:
"""restart a task"""
@@ -474,6 +475,7 @@ class TunnelManager:
self.data_cols[name]["disabled"] = "manual"
if name in self.tunnel_test_tasks:
self.tunnel_test_tasks[name].cancel()
+ del self.tunnel_test_tasks[name]
await asyncio.sleep(0)
break
@@ -536,7 +538,7 @@ class TunnelManager:
return
await self.revive_failed_tasks()
for key, value in self.scheduler_table.items():
- if value == 0 and key not in self.tunnel_test_tasks:
+ if value == 0:
self.write_log("rescheduling test for " + key + "\n")
tunnel_entry = self.data_cols[key]
test_task = asyncio.create_task(
@@ -546,8 +548,8 @@ class TunnelManager:
),
name=key,
)
- await asyncio.sleep(0)
self.tunnel_test_tasks[key] = test_task
+ await asyncio.sleep(0)
if value > 0:
self.scheduler_table[key] = self.scheduler_table[key] - 1
if value <= 0:
@@ -565,6 +567,9 @@ class TunnelManager:
self.write_log("\n")
except asyncio.CancelledError:
pass
+ except Exception as other_e:
+ if hasattr(other_e, "message"):
+ self.write_log(other_e.message)
async def tui_loop(self) -> None:
"""the tui loop"""