Use PollWatcher to always get filesystem updates
See https://github.com/rust-lang/mdBook/issues/2102#issuecomment-1810982299 for explanation on this Closes #2102, #2035, #383 and #1441
This commit is contained in:
parent
b7f46213c7
commit
f427f24586
|
@ -4,6 +4,7 @@ use ignore::gitignore::Gitignore;
|
||||||
use mdbook::errors::Result;
|
use mdbook::errors::Result;
|
||||||
use mdbook::utils;
|
use mdbook::utils;
|
||||||
use mdbook::MDBook;
|
use mdbook::MDBook;
|
||||||
|
use notify_debouncer_mini::Config;
|
||||||
use pathdiff::diff_paths;
|
use pathdiff::diff_paths;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::mpsc::channel;
|
use std::sync::mpsc::channel;
|
||||||
|
@ -117,8 +118,17 @@ where
|
||||||
|
|
||||||
// Create a channel to receive the events.
|
// Create a channel to receive the events.
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
|
// Notify backend configuration
|
||||||
|
let backend_config = notify::Config::default().with_poll_interval(Duration::from_secs(1));
|
||||||
|
// Debouncer configuration
|
||||||
|
let debouncer_config = Config::default()
|
||||||
|
.with_timeout(Duration::from_secs(1))
|
||||||
|
.with_notify_config(backend_config);
|
||||||
|
|
||||||
let mut debouncer = match notify_debouncer_mini::new_debouncer(Duration::from_secs(1), tx) {
|
let mut debouncer = match notify_debouncer_mini::new_debouncer_opt::<_, notify::PollWatcher>(
|
||||||
|
debouncer_config,
|
||||||
|
tx,
|
||||||
|
) {
|
||||||
Ok(d) => d,
|
Ok(d) => d,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Error while trying to watch the files:\n\n\t{:?}", e);
|
error!("Error while trying to watch the files:\n\n\t{:?}", e);
|
||||||
|
|
Loading…
Reference in New Issue