Skip to content

Commit

Permalink
v7.0 Config: Replace deprecated poll_interval signature with poll_int…
Browse files Browse the repository at this point in the history
…erval_v2
  • Loading branch information
zeroishero committed Nov 7, 2023
1 parent c4d0470 commit 8157d04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
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

0 comments on commit 8157d04

Please sign in to comment.