fix compile

Signed-off-by: tison <wander4096@gmail.com>
This commit is contained in:
tison
2024-03-26 14:43:53 +08:00
parent 704ac44c23
commit e6ed9ca43e
4 changed files with 9 additions and 11 deletions

View File

@@ -66,7 +66,7 @@ pub enum Error {
#[snafu(display("Failed to initialize a watcher for file {}", path))]
FileWatch {
path: Option<String>,
path: String,
#[snafu(source)]
error: notify::Error,
},

View File

@@ -45,13 +45,11 @@ impl WatchFileUserProvider {
let (tx, rx) = channel::<DebounceEventResult>();
let mut debouncer = new_debouncer(Duration::from_secs(1), None, tx)
.context(FileWatchSnafu { path: None })?;
.context(FileWatchSnafu { path: "<none>" })?;
debouncer
.watcher()
.watch(Path::new(filepath), RecursiveMode::NonRecursive)
.context(FileWatchSnafu {
path: Some(filepath),
})?;
.context(FileWatchSnafu { path: filepath })?;
let filepath = filepath.to_string();
std::thread::spawn(move || {

View File

@@ -451,7 +451,7 @@ pub enum Error {
#[snafu(display("Failed to initialize a watcher for file {}", path))]
FileWatch {
path: Option<String>,
path: String,
#[snafu(source)]
error: notify::Error,
},

View File

@@ -200,20 +200,20 @@ pub fn maybe_watch_tls_config(tls_server_config: Arc<ReloadableTlsServerConfig>)
let tls_server_config_for_watcher = tls_server_config.clone();
let (tx, rx) = channel::<notify::Result<notify::Event>>();
let mut watcher = notify::recommended_watcher(tx).context(FileWatchSnafu { path: None })?;
let mut watcher = notify::recommended_watcher(tx).context(FileWatchSnafu { path: "<none>" })?;
let cert_path = tls_server_config.get_tls_option().cert_path();
watcher
.watch(cert_path, RecursiveMode::NonRecursive)
.context(FileWatchSnafu {
path: Some(cert_path),
.with_context(|_| FileWatchSnafu {
path: cert_path.display().to_string(),
})?;
let key_path = tls_server_config.get_tls_option().key_path();
watcher
.watch(key_path, RecursiveMode::NonRecursive)
.context(FileWatchSnafu {
path: Some(key_path),
.with_context(|_| FileWatchSnafu {
path: key_path.display().to_string(),
})?;
std::thread::spawn(move || {