Skip to content

Commit

Permalink
ctk tail: Use 0.5 seconds polling interval instead of 0.1
Browse files Browse the repository at this point in the history
It is mostly sufficient and still provides enough interactivity.
By reducing the frequency, it will incur less spam on sys.jobs_log
itself.
  • Loading branch information
amotl committed Dec 18, 2024
1 parent a0aa293 commit ed593da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cratedb_toolkit/cmd/tail/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions cratedb_toolkit/cmd/tail/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ed593da

Please sign in to comment.