diff options
author | terminaldweller <thabogre@gmail.com> | 2023-02-20 06:52:54 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2023-02-20 06:52:54 +0000 |
commit | bb115226bbcc02d034e3171a68320764d56fd1f7 (patch) | |
tree | d0974f220e4f376c15fce31c55cf5d58646967bc | |
parent | fix: adding a new task by using SIGHUP would not add the test to the scheduler (diff) | |
download | tunneltop-bb115226bbcc02d034e3171a68320764d56fd1f7.tar.gz tunneltop-bb115226bbcc02d034e3171a68320764d56fd1f7.zip |
the tests would never complete and were never removed when flipping a task. added a new keybinding, t, to run a test on demand
-rw-r--r-- | pyproject.toml | 4 | ||||
-rwxr-xr-x | tunneltop/tunneltop.py | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/pyproject.toml b/pyproject.toml index 1ace9ed..170affb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [tool.poetry] name = "tunneltop" -version = "0.3.1" +version = "0.3.2" description = "A top-like tunnel manager" -authors = ["terminaldwelelr <devi@terminaldweller.com>"] +authors = ["terminaldweller <devi@terminaldweller.com>"] license = "GPL-3.0" readme = "README.md" homepage = "https://github.com/terminaldweller/tunneltop" diff --git a/tunneltop/tunneltop.py b/tunneltop/tunneltop.py index fb5c5a7..19e1459 100755 --- a/tunneltop/tunneltop.py +++ b/tunneltop/tunneltop.py @@ -490,6 +490,9 @@ class TunnelManager: await self.stop_task(task, self.tunnel_tasks) was_active = True self.data_cols[name]["disabled"] = "manual" + if name in self.tunnel_test_tasks: + self.tunnel_test_tasks[name].cancel() + await asyncio.sleep(0) break if not was_active: @@ -503,6 +506,11 @@ class TunnelManager: self.data_cols[name]["disabled"] = "" await asyncio.sleep(0) + def run_single_test(self, task_name): + """Set the counter to 0 so the scheduler will run the test""" + if task_name in self.scheduler_table: + self.scheduler_table[task_name] = 0 + async def quit(self) -> None: """Cleanly quit the applicaiton""" # scheduler checks for this to stop running new tests @@ -608,6 +616,9 @@ class TunnelManager: elif char == ord("r"): line_content = self.stdscr.instr(sel + 2, 1) await self.restart_task(line_content.decode("utf-8")) + elif char == ord("t"): + line_content = self.stdscr.instr(sel + 2, 1) + await self.run_single_test(line_content.decode("utf-8")) elif char == ord("q"): await self.quit() elif char == ord("s"): |