Skip to content

Commit dca3526

Browse files
committed
[sweep][ranker] always notify if sync is issued
1 parent 50c4e58 commit dca3526

File tree

4 files changed

+42
-42
lines changed

4 files changed

+42
-42
lines changed

Cargo.lock

+33-33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sweep/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ authors = ["Pavel Aslanov <[email protected]>"]
33
build = "build.rs"
44
edition = "2021"
55
name = "sweep"
6-
version = "0.16.10"
6+
version = "0.16.11"
77
include = ["**/*.rs", "src/icons.json", "Cargo.toml", "Cargo.lock", "README.md"]
88

99
[lib]

sweep/src/rank.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,12 @@ fn ranker_worker<H, N>(
203203

204204
// rank
205205
let rank_instant = Instant::now();
206-
let matches = match action {
206+
matches_prev = match action {
207207
DoNothing => {
208-
for sync in synced.drain(..) {
209-
sync.store(true, Ordering::Release);
208+
if synced.is_empty() {
209+
continue;
210210
}
211-
continue;
211+
matches_prev
212212
}
213213
Offset(offset) => {
214214
let mut matches = pool.alloc();
@@ -223,30 +223,29 @@ fn ranker_worker<H, N>(
223223
if !keep_order {
224224
matches.par_sort_unstable_by(|a, b| b.score.cmp(&a.score));
225225
}
226-
matches
226+
pool.promote(matches)
227227
}
228228
CurrentMatch => {
229229
let mut matches = pool.alloc();
230230
matches.clear();
231231
// score previous matches
232232
matches.extend(matches_prev.iter().cloned());
233233
rank(&ctx, scorer.clone(), &haystack, &mut matches, !keep_order);
234-
matches
234+
pool.promote(matches)
235235
}
236236
All => {
237237
let mut matches = pool.alloc();
238238
matches.clear();
239239
// score all haystack elements
240240
matches.extend((0..haystack.with(|hs| hs.len())).map(Match::new));
241241
rank(&ctx, scorer.clone(), &haystack, &mut matches, !keep_order);
242-
matches
242+
pool.promote(matches)
243243
}
244244
};
245245
let rank_elapsed = rank_instant.elapsed();
246246

247247
// update result
248248
rank_gen += 1;
249-
matches_prev = pool.promote(matches);
250249
result.with_mut(|result| {
251250
*result = Arc::new(RankedItems {
252251
haystack: haystack.clone(),

sweep/src/sweep.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1463,6 +1463,7 @@ where
14631463
.as_ref()
14641464
.map_or_else(|| true, |s| s.load(Ordering::Acquire))
14651465
{
1466+
tracing::debug!("[sweep_ui_worker][draw] suppressed");
14661467
return Ok(TerminalAction::WaitNoFrame);
14671468
}
14681469
render_supress_sync.take();

0 commit comments

Comments
 (0)