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

enrol_cohort needlessly performs an enrolment sync everytime update_course is called

XMLWordPrintable

      Any time update_course is called (i.e. from the core update course webservice or from the GUI in the edit settings page), the last thing it does is tell the enrolment methods it's been updated.

      This allows guest methods and such to update passwords and such, which is good. However, the enrol_cohort plugin performs a enrol_cohort_sync on the course! If the course has many cohorts and/or a large number of users in the cohorts, this can take a very long time to process, and so the websvc call or save action takes several minutes to return a response.

      As far as I can tell, there's no reason to ever do a sync at this point. Syncs are already done in cron, and when the cohort is first added or removed from the course. Even adding or removing a user from a cohort ensures that user is promptly [un]enrolled from the courses its in.

      Test for this change would be to add a cohort with several hundred users to a course, then to update the course description and hit save. Without the fix, it'll take quite awhile to return while it performs a sync (depending on the cohort size). With the fix, it'll return much faster.

            aolley Adam Olley
            aolley Adam Olley
            Dan Poltawski Dan Poltawski
            Nobody Nobody
            Votes:
            6 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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