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

Slow course subscribers access with DB enrol module

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.0.1
    • 1.9.8
    • Linux Debian Stable (Lenny) with standard apache2, standard php5, mysql cluster from Mysql
      ==> MOODLE 1.9.5
    • MySQL
    • MOODLE_19_STABLE
    • MOODLE_20_STABLE
    • Easy

      I know the 1.9.5 version is not supported, but I file this improvement after talking to Martin.

      WHAT HAPPENS:
      The more users log in and subscribe to meta courses via the database plugin, the process gets slower and slower.
      I saw this was due because for EVERY user that was logging in, the lib/moodlelib.php => sync_metacourse procedure was launched.
      This procedures resyncs ALL users and not only the one that triggered the action.

      This means that after 5.000 subscribers or so the DB was almost crashed and login took ages (more than 2 minutes)

      IMPROVEMENT:
      I modified 2 files:

      • FILE lib/moodlelib.php, function sync_metacourse ($Id: moodlelib.php,v 1.960.2.132 2009/05/15 07:22:23 skodak Exp $)
        2422 function sync_metacourse($course, $userid=0) {
        ...
        2481 // Get assignments of a user to a role that exist in the meta course, but
        2482 // not in any child courses. That is, get a list of the unassignments that need to be made.
        +++2483 if($userid) $roleexclusions.= " ra.userid=$userid AND ";
      • FILE lib/accesslib.php, function role_assign ($Id: accesslib.php,v 1.421.2.106 2009/05/23 20:07:12 skodak Exp $)
        2983 sync_metacourse($parent->parent_course, $userid); // added the $userid of the user that triggered the sync.

      After these modifications the login procedure with 11.000 users is taking less than 10 seconds.

      Still the cron job is synchronizing the whole metacourse as it is not sending the userid parameter.

            skodak Petr Skoda
            deligant Christian Deligant
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

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