Update to notify 5.0 stable (#5865)

# Objective

- Update notify dependency to 5.0.0 stable
- Fix breaking changes
- Closes #5861

## Solution

- RecommendedWatcher now takes a Config argument. Giving it the default Config should be the same behavior as before (check every 30 seconds)
This commit is contained in:
Ixentus 2022-09-02 15:54:54 +00:00
parent 662c6e9a34
commit 17d84e8811
2 changed files with 8 additions and 5 deletions

View File

@ -30,7 +30,7 @@ anyhow = "1.0.4"
thiserror = "1.0" thiserror = "1.0"
downcast-rs = "1.2.0" downcast-rs = "1.2.0"
fastrand = "1.7.0" fastrand = "1.7.0"
notify = { version = "=5.0.0-pre.15", optional = true } notify = { version = "5.0.0", optional = true }
parking_lot = "0.12.1" parking_lot = "0.12.1"
[target.'cfg(target_arch = "wasm32")'.dependencies] [target.'cfg(target_arch = "wasm32")'.dependencies]

View File

@ -1,5 +1,5 @@
use crossbeam_channel::Receiver; use crossbeam_channel::Receiver;
use notify::{Event, RecommendedWatcher, RecursiveMode, Result, Watcher}; use notify::{Config, Event, RecommendedWatcher, RecursiveMode, Result, Watcher};
use std::path::Path; use std::path::Path;
/// Watches for changes to files on the local filesystem. /// Watches for changes to files on the local filesystem.
@ -14,9 +14,12 @@ pub struct FilesystemWatcher {
impl Default for FilesystemWatcher { impl Default for FilesystemWatcher {
fn default() -> Self { fn default() -> Self {
let (sender, receiver) = crossbeam_channel::unbounded(); let (sender, receiver) = crossbeam_channel::unbounded();
let watcher: RecommendedWatcher = RecommendedWatcher::new(move |res| { let watcher: RecommendedWatcher = RecommendedWatcher::new(
sender.send(res).expect("Watch event send failure."); move |res| {
}) sender.send(res).expect("Watch event send failure.");
},
Config::default(),
)
.expect("Failed to create filesystem watcher."); .expect("Failed to create filesystem watcher.");
FilesystemWatcher { watcher, receiver } FilesystemWatcher { watcher, receiver }
} }