From bb115226bbcc02d034e3171a68320764d56fd1f7 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Mon, 20 Feb 2023 10:22:54 +0330 Subject: the tests would never complete and were never removed when flipping a task. added a new keybinding, t, to run a test on demand --- pyproject.toml | 4 ++-- 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 "] +authors = ["terminaldweller "] 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"): -- cgit v1.2.3