Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for pending adhoc tasks before executing new Scheduled task #177

Closed

Conversation

rajandangi
Copy link
Contributor

@rajandangi rajandangi commented Oct 15, 2024

This PR introduces a check for pending adhoc tasks before executing a new scheduled task in the cron_task class. By doing so, it ensures that redundant executions of the reengagement cron task are avoided when there are already pending tasks. This is particularly important as Moodle does not create redundant adhoc tasks by itself, but scheduled tasks might generate a large number of adhoc tasks when there are many course modules. Without completing the previous iteration of adhoc tasks, creating new ones would just add to the queue, potentially creating a massive queue and possible bottleneck.

Changes

  • Modified classes/task/cron_task.php
    - Added a method has_pending_adhoc_tasks to check for existing pending adhoc tasks.
    - Updated the execute method to skip execution if there are pending adhoc tasks.

@rajandangi rajandangi self-assigned this Oct 15, 2024
@danmarsden
Copy link
Member

a bunch of other work has landed around this and I'm not sure if this one is still needed/useful, and it's also against the older branch so would need to be rebased and dropped into the latest branch if it's still needed - closing for now, but happy for someone to re-open/consider adding this to the latest branch if needed.

@danmarsden danmarsden closed this Nov 26, 2024
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