Skip to content

Commit

Permalink
Fix ClaimQueue case of nothing scheduled on session boundary (#4065)
Browse files Browse the repository at this point in the history
Same issue but about av-cores was fixed in
#1403

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
  • Loading branch information
sandreim authored Apr 11, 2024
1 parent 643aa2b commit 69cc7f2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion polkadot/runtime/parachains/src/runtime_api_impl/vstaging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,22 @@
use crate::scheduler;
use primitives::{CoreIndex, Id as ParaId};
use sp_std::collections::{btree_map::BTreeMap, vec_deque::VecDeque};
use sp_runtime::traits::One;
use sp_std::{
collections::{btree_map::BTreeMap, vec_deque::VecDeque},
vec::Vec,
};

/// Returns the claimqueue from the scheduler
pub fn claim_queue<T: scheduler::Config>() -> BTreeMap<CoreIndex, VecDeque<ParaId>> {
let now = <frame_system::Pallet<T>>::block_number() + One::one();

// This explicit update is only strictly required for session boundaries:
//
// At the end of a session we clear the claim queues: Without this update call, nothing would be
// scheduled to the client.
<scheduler::Pallet<T>>::free_cores_and_fill_claimqueue(Vec::new(), now);

scheduler::ClaimQueue::<T>::get()
.into_iter()
.map(|(core_index, entries)| {
Expand Down

0 comments on commit 69cc7f2

Please sign in to comment.