Skip to content

Commit b1842cf

Browse files
committed
Explicitly prohibit --debounce 0
The `tick_rate` at which the debouncer library checks whether any events should now be dispatched shouldn't be 0. It cannot either be any greater than the debounce rate itself. Ideally, we may want to *disable* debouncing altogether when the user passes --debounce 0, but that'd require a special case to be made in the instrumentation, where we'd bypass the debouncer: that's another package to depend on, and ultimately deemed no worth the hassle. Ref: #2937 Ref: https://zola.discourse.group/t/watch-debounce-configuration/2666
1 parent 45c91c3 commit b1842cf

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

docs/content/documentation/getting-started/cli-usage.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ fail to see your change or get an error, try restarting `zola serve`.
102102

103103
By default, the live reload will be debounced by one full second so as to more
104104
gracefully handle multiple changes to your input files in rapid succession. You
105-
have control over that debouncing duration with the debounce flag. You may use
106-
`-d0` to disable it altogether.
105+
have control over that debouncing duration with the `--debounce <duration_ms>`
106+
flag.
107+
You may use `-d1` to (virtually) disable it altogether: for technical reasons
108+
(and keeping things simple), a "debounce" of 0 is not supported.
107109

108110
You can also point to a config file other than `config.toml` like so (note that the position of the `config` option is important):
109111

src/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ pub enum Command {
102102
#[clap(long)]
103103
extra_watch_path: Vec<String>,
104104

105-
/// Debounce time in milliseconds for the file watcher
106-
#[clap(short = 'd', long, default_value_t = 1000)]
105+
/// Debounce time in milliseconds for the file watcher (at least 1ms)
106+
#[clap(short = 'd', long, default_value_t = 1000, value_parser = clap::value_parser!(u64).range(1..))]
107107
debounce: u64,
108108
},
109109

0 commit comments

Comments
 (0)