edouardcourty / retryable-command
Retry commands if they fail, based on Symfony Commands
Requires
- php: >=7.4
- symfony/console: ^5.0|^6.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.37
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.4
This package is auto-updated.
Last update: 2025-03-03 16:08:31 UTC
README
This library adds a retry feature to Symfony Commands.
Usage
To make a command retryable, make it extend RetryableCommand\Command\RetryableCommand
.
To configure how many retries the command will do, you can either:
- Use the
setMaxRetry
command inside theconfigure
method - Use the
max-retry
CLI option when calling the command
The sleep timeout is calculated using the retryTimeout
that has to be implemented.
If you don't want to wait between retries, simply return 0.
This method accepts the current retry as a parameter, making it possible to compute dynamic retry timeouts depending on how many retries have been done already.
Contributing
If you wish to contribute to this project, feel free to submit a PR explaining your changes, and make sure to test your addition.
The pipeline has to be passing.
© - Edouard Courty