scripts: Increased default sleep time to 2 seconds

You forget one script, running in the background, hogging a whole
core, and suddenly watch's default 2 second sleep time makes a lot more
sense...

One of the main motivators for watch.py _was_ for shorter sleep times,
short enough to render realtime animations (watch is limited to 0.1
seconds for some reason?), but this doesn't mean it needs to be the
default. This can still be accomplished by explicitly specifying
-s/--sleep, and we probably don't want the default to hog all the CPU.

The use case for fast sleeps has been mostly replaced by -k/--keep-open
anyways.

For tailpipe.py and tracebd.py it's a bit less clear, but we probably
don't need to be spamming open calls 10 times a second.
This commit is contained in:
Christopher Haster
2025-02-12 23:53:53 -06:00
parent eae7665977
commit 2b1738e6d1
4 changed files with 11 additions and 11 deletions

View File

@@ -1445,11 +1445,10 @@ def main(csv_paths, *,
ptime = time.time()
inotify.read()
inotify.close()
# sleep for a minimum amount of time, this helps reduce
# flicker issues
# sleep a minimum amount of time to avoid flickering
time.sleep(max(0, (sleep or 0.01) - (time.time()-ptime)))
else:
time.sleep(sleep or 0.1)
time.sleep(sleep or 2)
except KeyboardInterrupt:
pass
@@ -1669,7 +1668,7 @@ if __name__ == "__main__":
'-s', '--sleep',
type=float,
help="Time in seconds to sleep between redraws when running "
"with -k. Defaults to 0.01.")
"with -k. Defaults to 2 seconds.")
def dictify(ns):
if hasattr(ns, 'subplots'):