From ed593da728955f7cfe9ab017a7d42ed3f31d4924 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Tue, 17 Dec 2024 23:40:54 +0100 Subject: [PATCH] ctk tail: Use 0.5 seconds polling interval instead of 0.1 It is mostly sufficient and still provides enough interactivity. By reducing the frequency, it will incur less spam on sys.jobs_log itself. --- cratedb_toolkit/cmd/tail/cli.py | 4 +++- cratedb_toolkit/cmd/tail/main.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cratedb_toolkit/cmd/tail/cli.py b/cratedb_toolkit/cmd/tail/cli.py index 16d9d1a..1a9bb8d 100644 --- a/cratedb_toolkit/cmd/tail/cli.py +++ b/cratedb_toolkit/cmd/tail/cli.py @@ -22,7 +22,9 @@ ) @click.option("--format", "format_", type=str, required=False, help="Select output format. Default: log / jsonl") @click.option("--follow", "-f", is_flag=True, required=False, help="Follow new records added, by polling the table") -@click.option("--interval", "-i", type=float, required=False, help="When following the tail, poll each N seconds. Default: 0.1") +@click.option( + "--interval", "-i", type=float, required=False, help="When following the tail, poll each N seconds. Default: 0.5" +) @click.option("--verbose", is_flag=True, required=False, help="Turn on logging") @click.option("--debug", is_flag=True, required=False, help="Turn on logging with debug level") @click.argument("resource", nargs=-1, type=click.UNPROCESSED) diff --git a/cratedb_toolkit/cmd/tail/main.py b/cratedb_toolkit/cmd/tail/main.py index f7fd9e7..4f3024c 100644 --- a/cratedb_toolkit/cmd/tail/main.py +++ b/cratedb_toolkit/cmd/tail/main.py @@ -86,13 +86,13 @@ class TableTailer: db: DatabaseAdapter resource: TableAddress - interval: float = 0.1 + interval: t.Optional[float] = None format: t.Optional[str] = None def __attrs_post_init__(self): self.db.internal = True if self.interval is None: - self.interval = 0.1 + self.interval = 0.5 if not self.format: if self.resource.fullname == "sys.jobs_log": self.format = "log"