https://kotlinlang.org logo
l

lawlorslaw

01/14/2023, 2:11 AM
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

Adrian Stypiński

01/14/2023, 7:32 AM
Maybe use kotlin-retry library?
l

lawlorslaw

01/14/2023, 8:22 AM
do you have the link?
a

Adrian Stypiński

01/14/2023, 8:37 AM
https://github.com/michaelbull/kotlin-retry i see it hasnt been updated since 2021. Perhaps you should find something else
l

lawlorslaw

01/14/2023, 9:11 AM
yeah i would like to find a solution that is recently maintained
a

Adrian Stypiński

01/14/2023, 9:12 AM
You can always use this lib as inspiration to your own implementation as it’s not that complicated to develop
j

Jakub Syty

01/15/2023, 10:18 PM
they recently released 2.0, so it's alive and well
l

Lukasz Kalnik

01/16/2023, 1:19 PM
#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
24 Views