Moodle
  1. Moodle
  2. MDL-25837

disasterous caching bug in course_overview block

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.2
    • Component/s: Performance
    • Labels:
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      15706

      Description

      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.

        Activity

          People

          • Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: