Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
bkchr authored Sep 22, 2024
1 parent 1a04152 commit 6bbf1a3
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions substrate/frame/message-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,10 @@ impl<T: Config> ServiceQueues for Pallet<T> {

// Get the maximum weight that processing a single message may take:
let max_weight = Self::max_message_weight(weight_limit).unwrap_or_else(|| {
check_queue_context(context);
if matches(context, ServiceQueuesContext::OnInitialize) {

Check failure on line 1597 in substrate/frame/message-queue/src/lib.rs

View workflow job for this annotation

GitHub Actions / cargo-check-all-crate-macos

expected function, found macro `matches`
defensive!("Not enough weight to service a single message.");
}
Weight::zero()
});

match with_service_mutex(|| {
Expand Down Expand Up @@ -1663,16 +1666,6 @@ impl<T: Config> ServiceQueues for Pallet<T> {
},
)
}

// Check the message queue context for on_idle and on_initialize status
// throw defensive message in `on_initialize` status
// don't throw defensive message in `on_idle` status
fn check_queue_context(context: ServiceQueuesContext) -> Weight {
if matches(context, ServiceQueuesContext::OnInitialize) {
defensive!("Not enough weight to service a single message.");
}
Weight::zero()
}
}

impl<T: Config> EnqueueMessage<MessageOriginOf<T>> for Pallet<T> {
Expand Down

0 comments on commit 6bbf1a3

Please sign in to comment.