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

Commit

Permalink
Filter out entries of different environments in LoadedPrograms::extra…
Browse files Browse the repository at this point in the history
…ct().
  • Loading branch information
Lichtso committed Oct 13, 2023
1 parent 2fdcf76 commit c193ca2
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions program-runtime/src/loaded_programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,27 +727,22 @@ impl LoadedPrograms {
|| entry.deployment_slot == current_slot
|| working_slot.is_ancestor(entry.deployment_slot)
{
if !Self::is_entry_usable(entry, current_slot, &match_criteria) {
missing.push((key, count));
return None;
}
if current_slot >= entry.effective_slot {
if !Self::is_entry_usable(entry, current_slot, &match_criteria) {
missing.push((key, count));
return None;
}

if let LoadedProgramType::Unloaded(environment) = &entry.program {
if Arc::ptr_eq(environment, &self.environments.program_runtime_v1)
|| Arc::ptr_eq(
environment,
&self.environments.program_runtime_v2,
)
{
// if the environment hasn't changed since the entry was unloaded.
unloaded.push((key, count));
} else {
if !Self::matches_environment(entry, &self.environments) {
missing.push((key, count));
return None;
}

if let LoadedProgramType::Unloaded(_environment) = &entry.program {
unloaded.push((key, count));
return None;
}
return None;
}

if current_slot >= entry.effective_slot {
let mut usage_count =
entry.tx_usage_counter.load(Ordering::Relaxed);
saturating_add_assign!(usage_count, count);
Expand Down

0 comments on commit c193ca2

Please sign in to comment.