Skip to content

Commit

Permalink
increased initial duration to increase backoff (#2879)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-britton-moj authored Dec 6, 2023
1 parent 58c7695 commit 41cdfaa
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import org.springframework.http.client.ClientHttpRequestInterceptor
import org.springframework.http.client.ClientHttpResponse
import org.springframework.web.client.RestClientException
import uk.gov.justice.digital.hmpps.retry.retry
import java.time.Duration

class RetryInterceptor : ClientHttpRequestInterceptor {
class RetryInterceptor(private val retries: Int = 3, private val delay: Duration = Duration.ofMillis(200)) :
ClientHttpRequestInterceptor {
override fun intercept(
request: HttpRequest,
body: ByteArray,
execution: ClientHttpRequestExecution
): ClientHttpResponse = retry(3, listOf(RestClientException::class)) {
): ClientHttpResponse = retry(retries, listOf(RestClientException::class), delay) {
execution.execute(request, body)
}
}

0 comments on commit 41cdfaa

Please sign in to comment.