-
Improvement
-
Resolution: Fixed
-
Minor
-
3.9.3, 3.11
-
MOODLE_311_STABLE, MOODLE_39_STABLE
-
MOODLE_311_STABLE
-
MDL-70444-dashboard-reset-progress-m -
Running my_reset_page_for_all_users on a large site can be extremely slow. This makes it very prone to not running to completion. Because it is wrapped in a transaction it can hog things for a long time and it also means when it fails you end up with nothing to show for it.
https://github.com/moodle/moodle/blob/master/my/lib.php#L178-L212
So potentially a few different thing which should improve things:
1) Unroll the transaction, I can't see any particular reason why they all need to be atomic. Only each individual user needs to be atomic
2) I'd limit the sql to pages of say 100 or 1000 users and do them in batches and if we keep the transaction wrap it around each batch. Make sure the batches full contain or do not contain all the block instances and pages for a single user, easiest is to probably ignore the last user in the batch as they likely wrap over and we can process them in the next page.
3) Add an argument for a progress bar so we can keep the calling page alive and show progress
4) Show the progress bar on a new intermediate page and make sure the session is unlocked