mirror of
https://github.com/solaeus/nucleo.git
synced 2024-11-12 18:17:11 +00:00
Move reset to seperate function (#10)
This commit is contained in:
parent
9c4b71027f
commit
7476504978
@ -157,11 +157,7 @@ impl<T: Sync + Send + 'static> Worker<T> {
|
||||
|
||||
// TODO: be smarter around reusing past results for rescoring
|
||||
if self.pattern.cols.iter().all(|pat| pat.is_empty()) {
|
||||
self.matches.clear();
|
||||
self.matches
|
||||
.extend((0..self.last_snapshot).map(|idx| Match { score: 0, idx }));
|
||||
// there are usually only very few in flight items (one for each writer)
|
||||
self.remove_in_flight_matches();
|
||||
self.reset_matches();
|
||||
self.process_new_items_trivial();
|
||||
if self.should_notify.load(atomic::Ordering::Relaxed) {
|
||||
(self.notify)();
|
||||
@ -170,10 +166,7 @@ impl<T: Sync + Send + 'static> Worker<T> {
|
||||
}
|
||||
|
||||
if pattern_status == pattern::Status::Rescore {
|
||||
self.matches.clear();
|
||||
self.matches
|
||||
.extend((0..self.last_snapshot).map(|idx| Match { score: 0, idx }));
|
||||
self.remove_in_flight_matches();
|
||||
self.reset_matches();
|
||||
}
|
||||
|
||||
let mut unmatched = AtomicU32::new(0);
|
||||
@ -250,4 +243,12 @@ impl<T: Sync + Send + 'static> Worker<T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn reset_matches(&mut self) {
|
||||
self.matches.clear();
|
||||
self.matches
|
||||
.extend((0..self.last_snapshot).map(|idx| Match { score: 0, idx }));
|
||||
// there are usually only very few in flight items (one for each writer)
|
||||
self.remove_in_flight_matches();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user