Acala icon indicating copy to clipboard operation
Acala copied to clipboard

Utility helper to schedule on_initialize hook execution

Open xlc opened this issue 1 year ago • 0 comments

We have multiple pallets that execute something periodically during on_initialize hook. Most of the them are doing something like if now % period === 0 { do_the_work() }. This means every once a while, on_initialize hook will execute the periodic logic for multiple pallets and could become expensive.

We need to update existing pallets to change the code to if now % period === offset { do_the_work() } so that we can ensure the work can be allocated on different blocks and then have some more helpers for us to allocate the offset value.

xlc avatar Aug 08 '22 23:08 xlc