Fix config file change detection logic in file watcher

This commit is contained in:
Taqman-probe
2026-05-30 00:34:35 +09:00
parent b17962e6d5
commit aa70d818b2

View File

@@ -37,7 +37,7 @@ pub async fn start(fp: String, mut toreturn: Sender<Configuration>) {
match event {
Ok(e) => match e.kind {
EventKind::Modify(ModifyKind::Data(_)) | EventKind::Create(..) | EventKind::Remove(..) => {
if e.paths[0].to_str().unwrap().ends_with("yaml") && start.elapsed() > Duration::from_secs(2) {
if e.paths.iter().any(|path| path.to_str() == Some(file_path)) && start.elapsed() > Duration::from_secs(2) {
start = Instant::now();
// info!("Config File changed :=> {:?}", e);
let snd = load_configuration(file_path, "filepath").await.0;