Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-58688

Calendar does not use courseid when retrieving course modules, significant performance decrease

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.3
    • 3.3
    • Calendar, Performance
    • MOODLE_33_STABLE
    • MOODLE_33_STABLE
    • wip-MDL-58688-master-c
    • Hide
      1. Create several modules visible in the calendar and on the dashboard. Example: assignment with due date, feedback with timeclose, etc
      2. Make one of the modules not available for student (restrict access)
      3. Login as student and view the "upcoming events" block, calendar, dashboard, make sure all events are displayed without errors, the events related to unavailable modules are not displayed
      4. Export calendar and make sure only visible events were exported
      5. Bonus: enable 'logall' (see also MDL-58689), view dashboard as a student and check the number of new queries from db table mdl_log_queries (there are several AJAX requests involved so you can't rely on the performance info in the bottom of the page)
      6. Revert the commit and do the same - the number of queries should be bigger
      Show
      Create several modules visible in the calendar and on the dashboard. Example: assignment with due date, feedback with timeclose, etc Make one of the modules not available for student (restrict access) Login as student and view the "upcoming events" block, calendar, dashboard, make sure all events are displayed without errors, the events related to unavailable modules are not displayed Export calendar and make sure only visible events were exported Bonus: enable 'logall' (see also MDL-58689 ), view dashboard as a student and check the number of new queries from db table mdl_log_queries (there are several AJAX requests involved so you can't rely on the performance info in the bottom of the page) Revert the commit and do the same - the number of queries should be bigger

    Description

      Calendar retrieves modules associated with calendar events using get_coursemodule_from_instance()

      This method always performs a DB query. Considering we have to retrieve course modinfo anyway to check the module availability, this DB query is completely unnecessary.

      We already know courseid (it is stored as part of the event) but we don't use it.

      I assume this was present before 3.3 as well but in 3.3 we added even more overhead

      Attachments

        Activity

          People

            marina Marina Glancy
            marina Marina Glancy
            cameron1729 cameron1729
            Dan Poltawski Dan Poltawski
            Adrian Greeve Adrian Greeve
            Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo, Matteo Scaramuccia, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              15/May/17