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

v7.0 Replace deprecated poll_interval signature #546

Merged
merged 1 commit into from
Nov 28, 2023
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
14 changes: 2 additions & 12 deletions notify/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,8 @@ impl Config {
}

/// Returns current setting
#[deprecated(
since = "6.1.0",
note = "use poll_interval_v2 to account for disabled automatic polling"
)]
pub fn poll_interval(&self) -> Duration {
// TODO: v7.0 break signature to option
self.poll_interval.unwrap_or_default()
}

/// Returns current setting
pub fn poll_interval_v2(&self) -> Option<Duration> {
// TODO: v7.0 break signature to option
pub fn poll_interval(&self) -> Option<Duration> {
// Changed Signature to Option
self.poll_interval
}

Expand Down
6 changes: 3 additions & 3 deletions notify/src/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::{
/// Event send for registered handler on initial directory scans
pub type ScanEvent = crate::Result<PathBuf>;

/// Handler trait for receivers of ScanEvent.
/// Handler trait for receivers of ScanEvent.
/// Very much the same as [EventHandler], but including the Result.
///
/// See the full example for more information.
Expand Down Expand Up @@ -476,7 +476,7 @@ pub struct PollWatcher {
watches: Arc<Mutex<HashMap<PathBuf, WatchData>>>,
data_builder: Arc<Mutex<DataBuilder>>,
want_to_stop: Arc<AtomicBool>,
/// channel to the poll loop
/// channel to the poll loop
/// currently used only for manual polling
message_channel: Sender<()>,
delay: Option<Duration>,
Expand Down Expand Up @@ -522,7 +522,7 @@ impl PollWatcher {
watches: Default::default(),
data_builder: Arc::new(Mutex::new(data_builder)),
want_to_stop: Arc::new(AtomicBool::new(false)),
delay: config.poll_interval_v2(),
delay: config.poll_interval(),
message_channel: tx,
};

Expand Down