I am looking to process deletions in batches yet avoid using on_initialize()
. Can I submit an inherent from the call to process next batch in a subsequent block? If so, what would the code to create/submit the inherent look like?
let LIMIT = 256;
pub fn delete(origin: OriginFor<T>, id:u32) -> DispatchResult {
let who = ensure_signed(origin)?;
let items = getItemsFromStorage(id);
let num_items = items.count();
let num_deleted = remove_items_for(items, LIMIT);
if (num_deleted < num_items) {
// Create and submit inherent to delete/remove the remainder of the items
//
// Inherent: delete_remaining_items_for(id);
//
}
Ok(())
}