diff --git a/notify-debouncer-full/src/lib.rs b/notify-debouncer-full/src/lib.rs index a6624984..8a6fb72a 100644 --- a/notify-debouncer-full/src/lib.rs +++ b/notify-debouncer-full/src/lib.rs @@ -208,6 +208,7 @@ impl DebounceDataInner { } } + // drain the entire queue, then process the expired events and re-add the rest // TODO: perfect fit for drain_filter https://github.com/rust-lang/rust/issues/59618 for (path, mut queue) in self.queues.drain() { let mut kind_index = HashMap::new(); @@ -246,13 +247,13 @@ impl DebounceDataInner { /// Returns all currently stored errors pub fn errors(&mut self) -> Vec { - let mut v = Vec::new(); - std::mem::swap(&mut v, &mut self.errors); - v + std::mem::take(&mut self.errors) } /// Add an error entry to re-send later on pub fn add_error(&mut self, error: Error) { + log::trace!("raw error: {error:?}"); + self.errors.push(error); }