Skip to content

Convert calsync observers to async adhoc tasks#3222

Open
patmr7 wants to merge 1 commit into
MOODLE_500_STABLEfrom
wip-130498-m500
Open

Convert calsync observers to async adhoc tasks#3222
patmr7 wants to merge 1 commit into
MOODLE_500_STABLEfrom
wip-130498-m500

Conversation

@patmr7

@patmr7 patmr7 commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Synchronous Graph API calls in calendar event observers blocked web requests for minutes in courses with large enrolments. Replace direct sync calls with a new synccalendarevent adhoc task queued by each observer instead.

Copilot AI left a comment

Copy link
Copy Markdown

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 moves Moodle calendar event syncing with Microsoft Outlook from synchronous observer execution into an asynchronous ad-hoc task, preventing long-running Graph API operations from blocking web requests (especially in large-enrolment courses).

Changes:

  • Added a new synccalendarevent ad-hoc task to perform create/update/delete event sync work in cron.
  • Updated calsync calendar event observers to enqueue the new task instead of calling Graph sync methods directly.

Reviewed changes

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

File Description
local/o365/classes/feature/calsync/task/synccalendarevent.php Introduces the new ad-hoc task that performs the actual single-event Outlook sync based on queued custom_data.
local/o365/classes/feature/calsync/observers.php Updates calendar event observers to enqueue synccalendarevent tasks for create/update/delete instead of syncing inline.

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

Comment thread local/o365/classes/feature/calsync/task/synccalendarevent.php
Comment thread local/o365/classes/feature/calsync/task/synccalendarevent.php
Comment thread local/o365/classes/feature/calsync/observers.php
Comment thread local/o365/classes/feature/calsync/observers.php
Synchronous Graph API calls in calendar event observers blocked web requests for minutes in courses with large enrolments. Replace direct sync calls with a new synccalendarevent adhoc task queued by each observer instead.
@patmr7 patmr7 force-pushed the wip-130498-m500 branch from 9eeb84d to 41a71bb Compare June 12, 2026 12:38
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 participants