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

Adding metacourses can fail due to 10 second time limit

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.7, 1.7.1, 1.8
    • 1.7, 1.8
    • Course
    • None
    • Postgres 8.1, slow development server
    • MOODLE_17_STABLE, MOODLE_18_STABLE
    • MOODLE_17_STABLE, MOODLE_18_STABLE

      Create a course with 5,000 students. Now create a metacourse. Add the 5k-student course to the metacourse.

      After 10 seconds, depending on whether you have debug turned on or not, either you get an error message about time limit running out, or the page loads entirely blank. (Hrm. That's helpful!)

      This is caused because adding students to a course takes longer under the new role system. The old timeouts were intended presumably to avoid the risk of timeout (since the timeout is 10 seconds per course) but in fact they cause one. A 5,000 user course on our slow development hardware takes approximately 2 minutes to transfer in current stable moodle.

      In case it's useful, here's some hacky code that (on a test server you don't care about) makes 5,000 students on the course:

      <?php
      require_once('config.php');

      set_time_limit(0);

      // Add 5k users to course 2
      $course=get_record('course','id',2);
      if(!$course) {
      error('No 1');
      }
      for($i=1;$i<=5000;$i++) {
      $user=new StdClass;
      $user->username="User$i";
      $user->firstname="First$i";
      $user->lastname="Last$i";
      if(!insert_record('user',$user))

      { error('No 2'); }

      if(!enrol_into_course($course,$user,'manual'))

      { error('No 3'); }


      if($i%100 == 0)

      { print "<p>$i</p>"; }

      }
      ?>

            quen Sam Marshall
            quen Sam Marshall
            Nobody Nobody (Inactive)
            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.