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

Remove manual insertion-sort from create_candidates #1254

Merged
merged 1 commit into from
Jul 14, 2023
Merged
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
31 changes: 10 additions & 21 deletions crates/symbolicator-service/src/services/objects/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,33 +254,22 @@ fn create_candidates(sources: &[SourceConfig], lookups: &[FoundMeta]) -> AllObje
for meta_lookup in lookups.iter() {
let source_id = meta_lookup.file_source.source_id();
source_ids.take(source_id);
let location = meta_lookup.file_source.uri();
if let Err(idx) =
candidates.binary_search_by_key(&(source_id, &location), |c| (&c.source, &c.location))
{
let info = create_candidate_info(meta_lookup);
candidates.insert(idx, info);
}
candidates.push(create_candidate_info(meta_lookup));
}

// Create a NotFound entry for each source from which we did not try and fetch anything.
for source_id in source_ids {
let location = RemoteFileUri::new("No object files listed on this source");

if let Err(idx) =
candidates.binary_search_by_key(&(&source_id, &location), |c| (&c.source, &c.location))
{
let info = ObjectCandidate {
source: source_id,
location,
download: ObjectDownloadInfo::NotFound,
unwind: Default::default(),
debug: Default::default(),
};
candidates.insert(idx, info);
}
let info = ObjectCandidate {
source: source_id,
location: RemoteFileUri::new("No object files listed on this source"),
download: ObjectDownloadInfo::NotFound,
unwind: Default::default(),
debug: Default::default(),
};
candidates.push(info);
}

// NOTE: This `into()` (or rather the `From` impl) does `sort` and `dedupe` these candidates.
candidates.into()
}

Expand Down
Loading