Skip to content

Instantly share code, notes, and snippets.

@munho
Forked from agustarc/retryWhenSample6.kt
Created January 10, 2022 05:55
Show Gist options
  • Save munho/684d5a01ee7176b221a33ffda797b963 to your computer and use it in GitHub Desktop.
Save munho/684d5a01ee7176b221a33ffda797b963 to your computer and use it in GitHub Desktop.
internal class ImagesRepositoryImpl(private val source: ImageDataSource) : ImagesRepository {
override fun getImages(params: Map<String, String>): Single<Result<ImagesResponse>> {
return source.getImages(params)
.map { Result.success(it) }
.compose(applyRetryPolicy(TIMEOUT, maxRetries = 5, interval = 2, unit = TimeUnit.SECONDS) { Single.just(Result.failure(it)) })
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment