Skip to content

Commit f74c29d

Browse files
committed
remove backoff logic from maybeReauthProviderIfNeeded
1 parent 17ae6e5 commit f74c29d

File tree

1 file changed

+1
-25
lines changed
  • plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials

1 file changed

+1
-25
lines changed

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials/ToolkitAuthManager.kt

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,12 @@ fun maybeReauthProviderIfNeeded(
320320

321321
BearerTokenAuthState.NEEDS_REFRESH -> {
322322
try {
323-
retryWithBackoff {
324-
return@retryWithBackoff runUnderProgressIfNeeded(project, AwsCoreBundle.message("credentials.refreshing"), true) {
323+
return runUnderProgressIfNeeded(project, AwsCoreBundle.message("credentials.refreshing"), true) {
325324
tokenProvider.refresh()
326325
hasNotifiedNetworkErrorOnce = false
327326
BearerTokenProviderListener.notifyCredUpdate(tokenProvider.id)
328327
return@runUnderProgressIfNeeded false
329328
}
330-
}
331329
} catch (e: Exception) {
332330
when {
333331
e is SsoOidcException -> {
@@ -419,28 +417,6 @@ private fun recordAddConnection(
419417
}
420418
}
421419

422-
private fun <T> retryWithBackoff(
423-
maxAttempts: Int = 3,
424-
initialDelayMs: Long = 1000,
425-
maxDelayMs: Long = 10000,
426-
factor: Double = 2.0,
427-
block: () -> T
428-
): T {
429-
var currentDelay = initialDelayMs
430-
repeat(maxAttempts) { attempt ->
431-
try {
432-
return block()
433-
} catch (e: Exception) {
434-
if (attempt == maxAttempts - 1 || e is SsoOidcException) throw e
435-
println("Attempt ${attempt + 1} failed. Retrying in $currentDelay ms")
436-
runBlocking { delay(currentDelay) }
437-
438-
currentDelay = min(maxDelayMs, (currentDelay * factor).toLong())
439-
}
440-
}
441-
throw IllegalStateException("This line should never be reached")
442-
}
443-
444420
private var hasNotifiedNetworkErrorOnce = false
445421

446422
data class ConnectionMetadata(

0 commit comments

Comments
 (0)