How can you implement logic that has retry with ex...
# android
l
How can you implement logic that has retry with exponential backoff? for example if
fooBar()
throws an exception ... you catch the exception and retry some finite number of times
stackoverflow 2
đŸ˜¶ 3
google 2
i am not looking to introduce
Flow
since my codebase isn't using
Coroutines
. we use
RxJava
a
Maybe use kotlin-retry library?
l
do you have the link?
a
https://github.com/michaelbull/kotlin-retry i see it hasnt been updated since 2021. Perhaps you should find something else
l
yeah i would like to find a solution that is recently maintained
a
You can always use this lib as inspiration to your own implementation as it’s not that complicated to develop
j
they recently released 2.0, so it's alive and well
l
#arrow has a solution for this
Although I'm not sure how easy it will be to integrate it with RxJava, as it's designed around
suspend
functions