Skip to content

Commit

Permalink
support notify 5.0.0-pre.15 (#146)
Browse files Browse the repository at this point in the history
* support notify 5.0.0-pre.15, fix #144

* pin to exact notify pre-release

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
  • Loading branch information
samuelcolvin and pksunkara authored May 17, 2022
1 parent 7a1ceb1 commit acea996
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 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.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"

[dependencies]
crossbeam-channel = "0.5.4"
notify = "5.0.0-pre.14"
notify = "=5.0.0-pre.15"
pyo3 = {version = "0.16.4", features = ["extension-module"]}

[lib]
Expand Down
7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use pyo3::exceptions::{PyFileNotFoundError, PyRuntimeError, PyTypeError};
use pyo3::prelude::*;

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

create_exception!(
Expand Down Expand Up @@ -125,7 +126,11 @@ impl RustNotify {
let watcher: WatcherEnum = match force_polling {
true => {
let delay = Duration::from_millis(poll_delay_ms);
let mut watcher = PollWatcher::with_delay(event_handler, delay).map_err(py_error)?;
let config = PollWatcherConfig {
poll_interval: delay,
compare_contents: false,
};
let mut watcher = PollWatcher::with_config(event_handler, config).map_err(py_error)?;
watcher_paths!(watcher, watch_paths, debug);
WatcherEnum::Poll(watcher)
}
Expand Down

0 comments on commit acea996

Please sign in to comment.