Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uprev notify to 5.0.0-pre.16 #182

Merged
merged 2 commits into from
Aug 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.15"
notify = "=5.0.0-pre.16"
pyo3 = {version = "0.16.4", features = ["extension-module", "abi3-py37"]}

[lib]
Expand Down
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