I am supporting a moodle (version 3.9) and with growing in students and courses I see that saving on editing courses start to become slow.
From my research I found that this is due to reset_all_state() method in:
Which is called from:
When I disable the "Completion tracking" from admin it works fast.
So I decide to give the job of resetting to a cron as a solution.
My plan is when a course is edited, instead of doing reset at this moment, to replace it with a simple db insert into one new queue table with the params that are send to reset_all_state().
And the course is saved super fast as when "Completion tracking" is turned off.
Then in the background the cron will execute all the logic from reset_all_state() including delete and purge, which make it slow.
Have anybody tried such approach or there is a better solution to speed up the reset part?
Thank you in advance.