From 0a835ccc652b8d411af827477a5084951b49098d Mon Sep 17 00:00:00 2001 From: Andriy Berestovskyy Date: Wed, 6 Nov 2024 19:03:04 +0100 Subject: [PATCH] chore: EXC-1754: Apply priority credit at the end of the round (#2381) This change is functionally equivalent but necessary for the upcoming priority-based eviction. --- rs/execution_environment/src/scheduler/round_schedule.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rs/execution_environment/src/scheduler/round_schedule.rs b/rs/execution_environment/src/scheduler/round_schedule.rs index 63ff09f2c6c..ac658f4dd34 100644 --- a/rs/execution_environment/src/scheduler/round_schedule.rs +++ b/rs/execution_environment/src/scheduler/round_schedule.rs @@ -334,6 +334,12 @@ impl RoundSchedule { + free_capacity_per_canister; // Increase accumulated priority by de-facto compute allocation. canister.scheduler_state.accumulated_priority += factual.into(); + + let has_aborted_or_paused_execution = + canister.has_aborted_execution() || canister.has_paused_execution(); + if !has_aborted_or_paused_execution { + RoundSchedule::apply_priority_credit(canister); + } } } @@ -417,9 +423,6 @@ impl RoundSchedule { let has_aborted_or_paused_execution = canister.has_aborted_execution() || canister.has_paused_execution(); - if !has_aborted_or_paused_execution { - RoundSchedule::apply_priority_credit(canister); - } let compute_allocation = canister.scheduler_state.compute_allocation; let accumulated_priority = canister.scheduler_state.accumulated_priority;