add maxRestarts to RestartWithBackoff #24129

This commit is contained in:
Patrik Nordwall 2018-01-16 18:28:10 +01:00 committed by Johan Andrén
parent 32987c8704
commit e4dd3c24fc
6 changed files with 393 additions and 22 deletions

View file

@ -56,6 +56,7 @@ public class RestartDocTest {
Duration.apply(3, TimeUnit.SECONDS), // min backoff
Duration.apply(30, TimeUnit.SECONDS), // max backoff
0.2, // adds 20% "noise" to vary the intervals slightly
20, // limits the amount of restarts to 20
() ->
// Create a source from a future of a source
Source.fromSourceCompletionStage(

View file

@ -37,7 +37,8 @@ class RestartDocSpec extends AkkaSpec with CompileOnlySpec {
val restartSource = RestartSource.withBackoff(
minBackoff = 3.seconds,
maxBackoff = 30.seconds,
randomFactor = 0.2 // adds 20% "noise" to vary the intervals slightly
randomFactor = 0.2, // adds 20% "noise" to vary the intervals slightly
maxRestarts = 20 // limits the amount of restarts to 20
) { ()
// Create a source from a future of a source
Source.fromFutureSource {