Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Scheduler pallet bloats Agenda too easily when there's lots of insertions/removals #11565

Closed
gavofyork opened this issue Jun 1, 2022 · 2 comments
Labels
I7-refactor Code needs refactoring.

Comments

@gavofyork
Copy link
Member

Right now, deleting a previously scheduled item results in a None "hole" in its Agenda for that block, which is not used since Scheduler just appends on Agenda when adding a new item. If items are continuously inserted and deleted then this can bloat storage and become a problem.

Instead, None items in the Agenda should be inserted into or the entire mechanism replaced with remove or swap_remove.

@gavofyork gavofyork added the I7-refactor Code needs refactoring. label Jun 1, 2022
@gavofyork gavofyork changed the title Scheduler pallet bloats Agenda too easily when there's lots of insertions/removals. Scheduler pallet bloats Agenda too easily when there's lots of insertions/removals Jun 1, 2022
@ggwpez
Copy link
Member

ggwpez commented Jun 5, 2022

I will tackle this in #11589 together with bound storage

@ggwpez ggwpez mentioned this issue Jun 5, 2022
1 task
@kianenigma kianenigma moved this to Backlog in Runtime / FRAME Aug 21, 2022
Repository owner moved this from Backlog to Done in Runtime / FRAME Oct 7, 2022
@ggwpez
Copy link
Member

ggwpez commented Oct 7, 2022

I think there is still a case where through preemption or re-scheduling an agenda can be all None.
But we could add a simple perpetual migration that clears out the all-None empty agendas on every runtime upgrade. @gavofyork

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I7-refactor Code needs refactoring.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants