Concurrency lock for scheduled tasks #17868
Labels
Bug
For errors / faults / flaws / inconsistencies etc.
c: Data Integrity & Accuracy
c: Platform
For Matomo platform changes that aren't impacting any of our APIs but improve the core itself.
Enhancement
For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
not-in-changelog
For issues or pull requests that should not be included in our release changelog on matomo.org.
Milestone
Currently a scheduled task can be triggered multiple times in parallel. As this can cause serious issues for tasks that manipulate data, we should provide some kind of concurrency lock for scheduled tasks to prevent that by default.
Simplest solution might be to create a Concurrency/Lock for each Task that is running. We could maybe use a default TTL of one hour, but allow each task to provide a custom TTL for that, so a longer running task can define a longer one.
This approach for sure wouldn't prevent concurrency for tasks that might run longer than the defined TTL. But it would at least prevent tasks being triggered multiple times.
To really avoid concurrency guess we would need to implement a more complex solution that really checks if a Task might be running in another process, but that might not be needed for now.
Note: there should also be a possibility to allow a task to be executed in parallel (maybe by setting the TTL to
null
or0
)The text was updated successfully, but these errors were encountered: