mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 03:27:58 +00:00
Scheduler: remove empty agenda on cancel (#12989)
* Scheduler: remove empty agenda on cancel * use iter any * fix benches * remove trailing None * Add CleanupAgendas migration Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fix ci Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Count non-empty agendas in migration Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -244,13 +244,17 @@ benchmarks! {
|
||||
}: _<SystemOrigin<T>>(schedule_origin, when, 0)
|
||||
verify {
|
||||
ensure!(
|
||||
Lookup::<T>::get(u32_to_name(0)).is_none(),
|
||||
"didn't remove from lookup"
|
||||
s == 1 || Lookup::<T>::get(u32_to_name(0)).is_none(),
|
||||
"didn't remove from lookup if more than 1 task scheduled for `when`"
|
||||
);
|
||||
// Removed schedule is NONE
|
||||
ensure!(
|
||||
Agenda::<T>::get(when)[0].is_none(),
|
||||
"didn't remove from schedule"
|
||||
s == 1 || Agenda::<T>::get(when)[0].is_none(),
|
||||
"didn't remove from schedule if more than 1 task scheduled for `when`"
|
||||
);
|
||||
ensure!(
|
||||
s > 1 || Agenda::<T>::get(when).len() == 0,
|
||||
"remove from schedule if only 1 task scheduled for `when`"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -280,13 +284,17 @@ benchmarks! {
|
||||
}: _(RawOrigin::Root, u32_to_name(0))
|
||||
verify {
|
||||
ensure!(
|
||||
Lookup::<T>::get(u32_to_name(0)).is_none(),
|
||||
"didn't remove from lookup"
|
||||
s == 1 || Lookup::<T>::get(u32_to_name(0)).is_none(),
|
||||
"didn't remove from lookup if more than 1 task scheduled for `when`"
|
||||
);
|
||||
// Removed schedule is NONE
|
||||
ensure!(
|
||||
Agenda::<T>::get(when)[0].is_none(),
|
||||
"didn't remove from schedule"
|
||||
s == 1 || Agenda::<T>::get(when)[0].is_none(),
|
||||
"didn't remove from schedule if more than 1 task scheduled for `when`"
|
||||
);
|
||||
ensure!(
|
||||
s > 1 || Agenda::<T>::get(when).len() == 0,
|
||||
"remove from schedule if only 1 task scheduled for `when`"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user