Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
4meta5 committed Jun 14, 2024
1 parent 682bcf6 commit 0945c0b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pallets/tasks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -937,9 +937,10 @@ pub mod pallet {
} else {
// assign tasks by least assigned
let mut shards = NetworkShards::<T>::iter_prefix(network).collect::<Vec<_>>();
shards.sort_by(|a, b| {
(ShardTasks::<T>::iter_prefix(a).count())
.cmp(&ShardTasks::<T>::iter_prefix(b).count())
shards.sort_by(|(a, _), (b, _)| {
ShardTasks::<T>::iter_prefix(*a)
.count()
.cmp(&ShardTasks::<T>::iter_prefix(*b).count())
});
shards.into_iter().rev().for_each(|(shard, _)| {
Self::schedule_tasks_shard(network, shard);
Expand Down

0 comments on commit 0945c0b

Please sign in to comment.