feat: キューがタイムアウトしたらそれを保存するように
This commit is contained in:
@@ -6,6 +6,6 @@ import kotlin.math.roundToLong
|
||||
|
||||
class ExponentialRetryPolicy(private val firstRetrySeconds: Int = 30) : RetryPolicy {
|
||||
override fun nextRetry(now: Instant, attempt: Int): Instant =
|
||||
now.plusSeconds(firstRetrySeconds.times((2.0).pow(attempt).roundToLong()))
|
||||
now.plusSeconds(firstRetrySeconds.times((2.0).pow(attempt).roundToLong()) - 30)
|
||||
|
||||
}
|
||||
@@ -25,12 +25,12 @@ class ExponentialRetryPolicyTest {
|
||||
fun exponential0() {
|
||||
val nextRetry = ExponentialRetryPolicy().nextRetry(Instant.ofEpochSecond(300), 0)
|
||||
|
||||
assertEquals(Instant.ofEpochSecond(330), nextRetry)
|
||||
assertEquals(Instant.ofEpochSecond(300), nextRetry)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun exponential1() {
|
||||
val nextRetry = ExponentialRetryPolicy().nextRetry(Instant.ofEpochSecond(300), 1)
|
||||
assertEquals(Instant.ofEpochSecond(360), nextRetry)
|
||||
assertEquals(Instant.ofEpochSecond(330), nextRetry)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user