Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Unifies missing entry insertion in LoadedPrograms::extract().
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Nov 22, 2023
1 parent 5edd283 commit f354941
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions program-runtime/src/loaded_programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,7 @@ impl<FG: ForkGraph> LoadedPrograms<FG> {
let mut extracting = extracted.lock().unwrap();
extracting.loaded.entries = keys
.filter_map(|(key, (match_criteria, count))| {
let mut reloading = false;
if let Some(second_level) = self.entries.get(&key) {
for entry in second_level.iter().rev() {
let is_ancestor = if let Some(fork_graph) = &self.fork_graph {
Expand All @@ -833,13 +834,12 @@ impl<FG: ForkGraph> LoadedPrograms<FG> {
if !Self::is_entry_usable(entry, current_slot, &match_criteria)
|| !Self::matches_environment(entry, environments)
{
extracting.missing.insert(key, (count, false));
return None;
break;
}

if let LoadedProgramType::Unloaded(_environment) = &entry.program {
extracting.missing.insert(key, (count, true));
return None;
reloading = true;
break;
}

let mut usage_count =
Expand All @@ -862,7 +862,7 @@ impl<FG: ForkGraph> LoadedPrograms<FG> {
}
}
}
extracting.missing.insert(key, (count, false));
extracting.missing.insert(key, (count, reloading));
None
})
.collect::<HashMap<Pubkey, Arc<LoadedProgram>>>();
Expand Down

0 comments on commit f354941

Please sign in to comment.