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

disasterous caching bug in course_overview block

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 2.0.2
    • 2.0.1
    • Performance
    • MOODLE_20_STABLE
    • MOODLE_20_STABLE
    • Easy

      The course_overview block has a major performance flaw which is causing it to call rebuild_course_cache() for each and every course it displays. For a normal student with 4 courses on their page, this resulted in over 3000 database queries! This does not just happen once - it happens every time My Moodle page loads for any user.

      I have attached a patch with a very simple fix. The course_overview block was not passing the modinfo attribute with the course objects when it passes them to print_overview(). This causes print_overview() to think the course has no modinfo cache and thus it goes off an rebuilds it all.

      In my test case, the number of DB queries went from 3474 down to 90.

            skodak Petr Skoda
            ashleyholman Ashley Holman
            David Mudrák (@mudrd8mz) David Mudrák (@mudrd8mz)
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.