-
Bug
-
Resolution: Fixed
-
Critical
-
3.1.4, 3.3.2, 3.4.3, 3.5.1, 3.6
-
MOODLE_31_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
-
MOODLE_34_STABLE, MOODLE_35_STABLE
-
MDL-57968-master -
Since Moodle 3.1, Moodle makes an AJAX request to core_fetch_notifications on all pages. This seems unnecessary, since all it does is load notifications from the session; it's unlikely that notifications would be added between when the page loads and when this AJAX request is triggered (immediately).
For example, supposing a server receives 20 requests for normal PHP pages per second under Moodle 3.0 (with messaging turned off), this increases to approximately 40 in Moodle 3.1. Or from 40 to 60 with messaging turned on. While these extra requests are probably easy to handle, it's still additional load, additional log entries, etc. and given there is almost no benefit for the cost, this seems like a performance bug.
I discussed this in developer chat:
Dan Poltawski, [14.02.17 12:15]
I think its worth an issue about that one yes. I can't think of a reason why we need to do a poll for those notifications
Andrew Nicols, [14.02.17 12:33]
The original reason was to allow for notifications that are pushed after footer. But realistically it's an edge case
Andrew Nicols, [14.02.17 12:33]
It was discussed when it was integrated.
The mechanism for this is that lib/outputrenderers.php, function footer() calls $this->page->requires->js_call_amd('core/notification', 'init', ...) which is in lib/amd/src/notifications.js; the last thing this function does is notificationModule.fetchNotifications() which makes the AJAX call.
So anyway - I think this is probably a performance bug (it would be preferable to disallow notifications after calling the footer, rather than to make all these extra AJAX requests), but it may be debatable...
- blocks
-
MDL-62658 Ensure clicked notifications are marked read - Regression: A required parameter (notificationid) was missing
- Closed
- has been marked as being related by
-
MDL-59226 Long load times on Moodle front page
- Closed
-
MDL-57543 Auto-bulk Ajax requests into a single request when possible
- Closed
- Testing discovered
-
MDL-62678 Unnecessary AJAX request core_fetch_notifications on all pages
- Closed