I am happy to announce another improvement of my PHP library "PHP-Task". This improvement was initiated by a customer project of Sulu and is already in use for real-world projects.
As the big new feature of the release, it allows the rescheduling of failing tasks.
Retry of failing tasks
Some of the tasks which will be executed by a handler are risky and could fail. This includes for example long running processes or tasks which need to wait for I/O (input/output).
If these tasks fail the retry will be scheduled as soon as possible. To indicate that the task was rescheduled a newly introduced property "attempts" will be increased. Each handler can specify a maximum number of attempts for the execution. Afterwards, the task will be marked as failed.
For more details about this feature, you can see the PR php-task/php-task#39 or the documentation.
Task isolation
The second big feature of this release was implemented in the php-task/task-bundle. It allows the isolation of the processes which executes the tasks.
task:
executor:
type: separate
separate:
console_path: '%kernel.root_dir%/../bin/console'
process_timeout: null
To enable this feature you can simply change the configuration value of "task.executor.type" to "seperate". This executor uses the symfony/process component to call the symfony command "task:execute" in an own process.
By using an own process the tasks cannot influence each other and make the cronjob more stable and reliable.
For more details about this feature, you can see the PR php-task/TaskBundle#40 or the documentation.
Update
You can update the library and the bundle by running following command which updates the database schema.
bin/console doctrine:schema:update
Now you are able to use the new features. Stay tuned for upcoming things.