Skip to content

Commit

Permalink
fix use of config
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Aug 14, 2022
1 parent 8f0777d commit 15fa415
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ use pyo3::exceptions::{PyFileNotFoundError, PyRuntimeError, PyTypeError};
use pyo3::prelude::*;

use notify::event::{Event, EventKind, ModifyKind, RenameMode};
use notify::poll::PollWatcherConfig;
use notify::{ErrorKind, PollWatcher, RecommendedWatcher, RecursiveMode, Result as NotifyResult, Watcher};
use notify::{
Config as NotifyConfig, ErrorKind, PollWatcher, RecommendedWatcher, RecursiveMode, Result as NotifyResult, Watcher,
};

create_exception!(
_rust_notify,
Expand Down Expand Up @@ -134,11 +135,8 @@ impl RustNotify {
macro_rules! create_poll_watcher {
($msg_template:literal) => {{
let delay = Duration::from_millis(poll_delay_ms);
let config = PollWatcherConfig {
poll_interval: delay,
compare_contents: false,
};
let mut watcher = match PollWatcher::with_config(event_handler, config) {
let config = NotifyConfig::default().with_poll_interval(delay);
let mut watcher = match PollWatcher::new(event_handler, config) {
Ok(watcher) => watcher,
Err(e) => return wf_error!($msg_template, e),
};
Expand All @@ -150,7 +148,7 @@ impl RustNotify {
let watcher: WatcherEnum = match force_polling {
true => create_poll_watcher!("Error creating poll watcher: {}"),
false => {
match RecommendedWatcher::new(event_handler.clone()) {
match RecommendedWatcher::new(event_handler.clone(), NotifyConfig::default()) {
Ok(watcher) => {
let mut watcher = watcher;
watcher_paths!(watcher, watch_paths, debug);
Expand Down

0 comments on commit 15fa415

Please sign in to comment.