Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit99fa193

Browse files
bug#46797 [Messenger] Ceil waiting time when multiplier is a float on retry (WissameMekhilef)
This PR was submitted for the 6.1 branch but it was squashed and merged into the 4.4 branch instead.Discussion----------[Messenger] Ceil waiting time when multiplier is a float on retry| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |#46795| License | MIT| Doc PR | Not requiredIn the Messenger - MultiplierRetryStrategy the return type for the function `getWaitingTime` is int, however with the computation of that function we were returning a float, this is because float * int returns a float and the attribute $multiplier is a float.With this fix, we are rounding up the delay and casting into an int.Commits-------3b62a06 [Messenger] Ceil waiting time when multiplier is a float on retry
2 parents0c38f36 +3b62a06 commit99fa193

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,6 @@ public function getWaitingTime(Envelope $message): int
8080
return$this->maxDelayMilliseconds;
8181
}
8282

83-
return$delay;
83+
return(int)ceil($delay);
8484
}
8585
}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testIsRetryableWithNoStamp()
5252
/**
5353
* @dataProvider getWaitTimeTests
5454
*/
55-
publicfunctiontestGetWaitTime(int$delay,int$multiplier,int$maxDelay,int$previousRetries,int$expectedDelay)
55+
publicfunctiontestGetWaitTime(int$delay,float$multiplier,int$maxDelay,int$previousRetries,int$expectedDelay)
5656
{
5757
$strategy =newMultiplierRetryStrategy(10,$delay,$multiplier,$maxDelay);
5858
$envelope =newEnvelope(new \stdClass(), [newRedeliveryStamp($previousRetries)]);
@@ -83,5 +83,10 @@ public function getWaitTimeTests(): iterable
8383
// never a delay
8484
yield [0,2,10000,0,0];
8585
yield [0,2,10000,1,0];
86+
87+
// Float delay
88+
yield [1000,1.5555,5000,0,1000];
89+
yield [1000,1.5555,5000,1,1555];
90+
yield [1000,1.5555,5000,2,2419];
8691
}
8792
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp