Skip to content

Commit

Permalink
fix: sandbox retries
Browse files Browse the repository at this point in the history
  • Loading branch information
ttypic committed Nov 22, 2024
1 parent 0067565 commit 77a892a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions chat-android/src/test/java/com/ably/chat/Sandbox.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,25 @@ import io.ably.lib.realtime.AblyRealtime
import io.ktor.client.HttpClient
import io.ktor.client.engine.cio.CIO
import io.ktor.client.plugins.HttpRequestRetry
import io.ktor.client.plugins.HttpRequestTimeoutException
import io.ktor.client.request.get
import io.ktor.client.request.post
import io.ktor.client.request.setBody
import io.ktor.client.statement.HttpResponse
import io.ktor.client.statement.bodyAsText
import io.ktor.http.ContentType
import io.ktor.http.contentType
import io.ktor.http.isSuccess

val client = HttpClient(CIO) {
private val client = HttpClient(CIO) {
install(HttpRequestRetry) {
retryOnServerErrors(maxRetries = 4)
maxRetries = 5
retryIf { _, response ->
!response.status.isSuccess()
}
retryOnExceptionIf { _, cause ->
cause is HttpRequestTimeoutException
}
exponentialDelay()
}
}
Expand Down

0 comments on commit 77a892a

Please sign in to comment.