Closed
Description
There is an issue with delay when multiplierExpression is used. It starts since version 2.0.0. I've found that issue probably comes from aspectjweaver.
I have simple spring service writen in kotlin and really simple test for it. Test will fail with spring-retry 2.0.0 up to 2.0.4 but will pass for version 1.3.4
After bumping aspectjweaver from 1.9.20 to 1.9.20.1 building spring-retry locally problem was solved and test has passed
class RetiedService() {
@Retryable(IllegalArgumentException::class,
backoff = Backoff(
delayExpression = "\${setup.delay}",
multiplierExpression = "\${setup.multiplier}",
),
maxAttempts = 4)
fun toBeRetried() {
println ("${Instant.now()} Running method")
willThrow()
}
private fun willThrow() {
throw IllegalArgumentException("some exception")
}
}
Properties
setup.delay=500
setup.multiplier=2.0
And test
@SpringBootTest
class Demo3ApplicationTests {
@Autowired
lateinit var service: RetiedService
@Test
fun contextLoads() {
val time = measureTimeMillis {
assertThrows<IllegalArgumentException> {
service.toBeRetried()
}
}
println(time)
assert(time > 3500)
}
}