-
Notifications
You must be signed in to change notification settings - Fork 242
[47030] Duplicate Execution of Service Task "Send Email" After Boundary Timer #8676
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
base: develop
Are you sure you want to change the base?
Conversation
- Introduced atomic claiming mechanism in TaskSchedulerManager to prevent duplicate task executions. - Added CLAIM_TIMEOUT_MINUTES constant to define the timeout for stale claimed tasks. - Implemented releaseStaleClaimedTasks method to release tasks that have been claimed for too long. - Refactored scheduleTasks method to utilize the new atomic claim logic. - Updated ScheduledTask model to include claimed_by and claimed_at fields. - Created migration to add claimed fields to the scheduled_tasks table. - Added tests to ensure atomic claim functionality and stale claim release behavior.
caleeli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcoAntonioNina Laravel already have a feature to prevent overlapping, could you consider to use it to prevent backward compatibility problems: https://laravel.com/docs/12.x/scheduling#preventing-task-overlaps
- Updated the bpmn:timer command in Kernel.php to prevent overlapping executions by adding the withoutOverlapping method with a 5-minute timeout.
|
QA server K8S was successfully deployed https://ci-5f82585a9c.engk8s.processmaker.net |
| // We filter by unclaimed tasks only, but evaluate nextDate for each | ||
| $tasks = ScheduledTask::whereNull('claimed_by')->cursor(); | ||
|
|
||
| foreach ($tasks as $task) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please request QA to tests with thousand requests with tasks with boundary events.
…r overlap in app.php.
|
QA server K8S was successfully deployed https://ci-5f82585a9c.engk8s.processmaker.net |
|





Issue & Reproduction Steps
When you have a boundary timer and an email sending configured, the scheduler for some reason starts to duplicate the sendings either because of a delay or because some other task is doing it.
This pull request attempts to prevent another task or the scheduler itself from resending the email.
Solution
How to Test
The process should successfully execute email sending.
Ideally, you should test with a large number of configured ScheduleTasks.
Related Tickets & Packages
Code Review Checklist
ci:deploy