File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
model-client/src/jvmMain/kotlin/org/modelix/model/oauth Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import kotlinx.coroutines.launch
35
35
import kotlinx.coroutines.withContext
36
36
import org.modelix.kotlin.utils.urlEncode
37
37
import java.net.SocketException
38
+ import java.net.SocketTimeoutException
38
39
39
40
@Suppress(" UndocumentedPublicClass" ) // already documented in the expected declaration
40
41
actual class ModelixAuthClient {
@@ -62,11 +63,16 @@ actual class ModelixAuthClient {
62
63
}
63
64
64
65
fun Credential.alwaysRefresh (): Credential ? {
65
- try {
66
- val success = refreshToken()
67
- if (success) return this
68
- } catch (e: TokenResponseException ) {
69
- LOG .warn(" Could not refresh the access token: ${e.details} " )
66
+ for (attempt in 1 .. 3 ) {
67
+ try {
68
+ val success = refreshToken()
69
+ if (success) return this
70
+ } catch (e: SocketTimeoutException ) {
71
+ LOG .warn(e) { " Token refresh timed out" }
72
+ } catch (e: TokenResponseException ) {
73
+ LOG .warn(" Could not refresh the access token: ${e.details} " )
74
+ break
75
+ }
70
76
}
71
77
return null
72
78
}
You can’t perform that action at this time.
0 commit comments