Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4d8a01e

Browse filesBrowse files
committed
minor #34110 [Messenger] remove infinite (nullable) max retries (Tobion)
This PR was merged into the 4.4 branch. Discussion ---------- [Messenger] remove infinite (nullable) max retries | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #33284 | License | MIT | Doc PR | Infinite retries are useless and putting a high enough number is more self-explaining. Infinite retries could not be configured using the framework anyway, see issue. Commits ------- 4a6ec85 [Messenger] remove nullable max retries
2 parents c5024bd + 4a6ec85 commit 4d8a01e
Copy full SHA for 4d8a01e

File tree

Expand file treeCollapse file tree

2 files changed

+2
-16
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+2
-16
lines changed

‎src/Symfony/Component/Messenger/Retry/MultiplierRetryStrategy.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Retry/MultiplierRetryStrategy.php
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ class MultiplierRetryStrategy implements RetryStrategyInterface
3838
private $maxDelayMilliseconds;
3939

4040
/**
41-
* @param int $maxRetries The maximum number of time to retry (null means indefinitely)
41+
* @param int $maxRetries The maximum number of times to retry
4242
* @param int $delayMilliseconds Amount of time to delay (or the initial value when multiplier is used)
4343
* @param float $multiplier Multiplier to apply to the delay each time a retry occurs
4444
* @param int $maxDelayMilliseconds Maximum delay to allow (0 means no maximum)
4545
*/
46-
public function __construct(?int $maxRetries = 3, int $delayMilliseconds = 1000, float $multiplier = 1, int $maxDelayMilliseconds = 0)
46+
public function __construct(int $maxRetries = 3, int $delayMilliseconds = 1000, float $multiplier = 1, int $maxDelayMilliseconds = 0)
4747
{
4848
$this->maxRetries = $maxRetries;
4949

@@ -65,10 +65,6 @@ public function __construct(?int $maxRetries = 3, int $delayMilliseconds = 1000,
6565

6666
public function isRetryable(Envelope $message): bool
6767
{
68-
if (null === $this->maxRetries) {
69-
return true;
70-
}
71-
7268
$retries = RedeliveryStamp::getRetryCountFromEnvelope($message);
7369

7470
return $retries < $this->maxRetries;

‎src/Symfony/Component/Messenger/Tests/Retry/MultiplierRetryStrategyTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Tests/Retry/MultiplierRetryStrategyTest.php
-10Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,6 @@ public function testIsRetryable()
2626
$this->assertTrue($strategy->isRetryable($envelope));
2727
}
2828

29-
public function testIsRetryableWithNullMax()
30-
{
31-
$strategy = new MultiplierRetryStrategy(null);
32-
$envelope = new Envelope(new \stdClass(), [new RedeliveryStamp(0, 'sender_alias')]);
33-
$this->assertTrue($strategy->isRetryable($envelope));
34-
35-
$envelope = new Envelope(new \stdClass(), [new RedeliveryStamp(1, 'sender_alias')]);
36-
$this->assertTrue($strategy->isRetryable($envelope));
37-
}
38-
3929
public function testIsNotRetryable()
4030
{
4131
$strategy = new MultiplierRetryStrategy(3);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.