-
Bug
-
Resolution: Fixed
-
Critical
-
4.0.1
-
-
MOODLE_400_STABLE
-
MOODLE_400_STABLE
-
Moodle App 4.0.2
In the forum prefetch, we only download the first 2 pages of discussions and all their posts. However, when the prefetch starts we call invalidateContent, and this function is fetching all pages of discussions because it doesn't specify a "numPages".
IMO the invalidateContent function should use ONLY_CACHE instead of PREFER_CACHE to get the stored pages, and stop obtaining more once a request fails.
EDIT: While investigating the issue I found 3 different bugs:
- The "recursive" function in getDiscussionsInPages doesn't pass the page to the getDiscussions, it always fetches the page 0. This causes an infinite loop when downloading a single forum from the Course downloads page.
- As said above, we should use ONLY_CACHE instead of PREFER_CACHE to get only the "downloaded" pages.
- In the Course downloads page, the template calls prefetchModule(module, section), but the function is defined as prefetchModule(module, refresh = false). So it's always considered as refresh=true but that wasn't intended.