added retry with exponential backoff
Description
This MR implements retrying refreshing token by maintaining an exponential backoff algorithm if any error is faced.
Screenshots
Technical details
Exponential backoff is implemented this way (5 secs.., 10 secs..., 15 secs.....). If the delay crosses 300 seconds, it won't retry further.
suspend fun <T> retryWithBackoff(operation: suspend () -> T, retryDelayInSecond: Int = -1): T?
A method (retryWithBackoff) is implemented that takes a method (operation) as a parameter which will be retried and returns a generic type of Object. If the retry requested function (operation) returns ResultSupreme
, then error is determined by checking ResultSupreme.isSuccess()
and checking the exception is available in ResultSupreme.
If the retry requested function (operation) returns another type of object, then error is determined by handling the exception.