edouardcourty / retryable-command
Retry commands if they fail, based on Symfony Commands
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/edouardcourty/retryable-command
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-10-31 00:18:12 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
setMaxRetrycommand inside theconfiguremethod - Use the
max-retryCLI 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