Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Necriso
Copy link

@Necriso Necriso commented Jun 12, 2025

This pull request introduces parallel running cron jobs and a locking mechanism to prevent concurrent execution of the same cron job. The primary changes include the addition of a LockedExecutor class, modifications to the CronRunCommand to use this executor, and the inclusion of the Symfony Lock component as a dependency.

Enhancements to job execution with locking:

  • New LockedExecutor class: Introduced a new LockedExecutor class in Cron/LockedExecutor.php to manage job execution with a locking mechanism. This prevents concurrent execution of the same job by utilizing the Symfony Lock component. It includes methods for acquiring and releasing locks, as well as overriding job lifecycle methods like startProcesses and isRunning.

  • Integration of LockedExecutor in CronRunCommand: Updated the CronRunCommand class to replace the default executor with the new LockedExecutor. A helper method createLockedExecutor was added to configure the executor with a lock factory that uses filesystem locks. [1] [2]

Dependency updates:

  • Added Symfony Lock component: Updated composer.json to include the Symfony Lock component (symfony/lock) as a dependency to enable the locking functionality.

Code organization:

  • Namespace and imports: Added necessary imports for LockedExecutor, LockFactory, and FlockStore in CronRunCommand.php to support the new locking mechanism. [1] [2]

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.

3 participants