Skip to content

Comments

Move observer triggered team owner/member sync for individual users to ad-hoc tasks#3040

Open
weilai-irl wants to merge 1 commit intoMOODLE_500_STABLEfrom
wip-126133-m500
Open

Move observer triggered team owner/member sync for individual users to ad-hoc tasks#3040
weilai-irl wants to merge 1 commit intoMOODLE_500_STABLEfrom
wip-126133-m500

Conversation

@weilai-irl
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings February 19, 2026 16:43
@weilai-irl weilai-irl self-assigned this Feb 19, 2026
@weilai-irl weilai-irl added this to the 2026-01 milestone Feb 19, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Microsoft 365 group membership synchronization for individual users from synchronous observer-triggered calls to asynchronous ad-hoc tasks. The change improves performance and resilience by offloading potentially slow Microsoft Graph API calls to the task queue rather than blocking during Moodle event processing.

Changes:

  • Created new usergroupmembershipsync ad-hoc task to handle individual user-course group membership synchronization
  • Updated four event observers (user_enrolment_updated, enrol_instance_updated, role_assigned, role_unassigned) to queue ad-hoc tasks instead of making synchronous API calls
  • Added language string for the new task name

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
local/o365/version.php Updated plugin version number to 2025040820.02
local/o365/lang/en/local_o365.php Added language string 'task_usergroupmembershipsync' for the new ad-hoc task
local/o365/classes/task/usergroupmembershipsync.php New ad-hoc task class that syncs a single user's role in a course group to Microsoft 365
local/o365/classes/observers.php Modified four event handlers to queue ad-hoc tasks instead of calling sync_user_role_in_course_group directly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 minutes of blocked session in browser when enrolling users in course

1 participant