Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[FrameworkBundle][Messenger] AddRetryStrategyStamp#62278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:7.4
Are you sure you want to change the base?
Conversation
RetryStrategyStampRetryStrategyStamp1fa3c11 toadec243Compare| */ | ||
| final class DynamicRetryStrategy implements RetryStrategyInterface | ||
| { | ||
| public function __construct(private RetryStrategyInterface $fallbackStrategy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| publicfunction __construct(privateRetryStrategyInterface$fallbackStrategy) | |
| publicfunction __construct(privatereadonlyRetryStrategyInterface$fallbackStrategy) |
| publicfunction__construct( | ||
| private ?bool$retryable =null, | ||
| private ?int$waitingTime =null, | ||
| ) { | ||
| } | ||
| publicfunctionisRetryable(): ?bool | ||
| { | ||
| return$this->retryable; | ||
| } | ||
| publicfunctiongetWaitingTime(): ?int | ||
| { | ||
| return$this->waitingTime; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| publicfunction __construct( | |
| private ?bool$retryable =null, | |
| private ?int$waitingTime =null, | |
| ) { | |
| } | |
| publicfunction isRetryable(): ?bool | |
| { | |
| return$this->retryable; | |
| } | |
| publicfunction getWaitingTime(): ?int | |
| { | |
| return$this->waitingTime; | |
| } | |
| publicfunction __construct( | |
| publicreadonly ?bool$retryable =null, | |
| publicreadonly ?int$waitingTime =null, | |
| ) { | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Not sure about the name: this doesn't configure the strategy - just the retriability
Also, when retryable = true I'm not sure this makes senseNoRetryStamp might be more appropriate for disabling retries.
But then: you example about RunCommandMessage makes me think this is a concern that belongs to the message - not to the stamp. The question is: from the pov of messenger, should a failure of the command mean that the message wasn't handled successfully? It depends if the failure comes from the command being unable to run because eg it failed to start (missing binary, etc) or because the message yields to an non-zero exit code. Which is the case you want to skip.
Alternative idea: make this a concern of RunCommandMessage (and RunProcessMessage) - eg with status codes to consider OK from the pov of messenger.
Sometimes you only know if a message should be retried or not when dispatching the message, e.g.
RunCommandMessagewith one command should be retried, but not with another command. I'm proposing to add a stamp & decorator strategy to make that possible.Examples
or e.g. if a single message class should never be retried:
It is worth noting that
RecoverableMessageInterface&UnrecoverableExceptionInterfacewould still have higher priority than this stamp.This is somewhat related to#62056 & could be useful for#50462 to allow chain-specific retry behavior.