-
Notifications
You must be signed in to change notification settings - Fork 272
fix(amazonq): add retries for /transform APIs #5751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
3805f06
058d228
3679de3
21d3966
bd6cbd7
db33b04
5abc53b
bcfeb21
d4f9edf
766a1c3
9079590
a6092d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -144,16 +144,10 @@ suspend fun JobId.pollTransformationStatusAndPlan( | |||
refreshToken(project) | ||||
return@waitUntil state | ||||
} catch (e: InvalidGrantException) { | ||||
CodeTransformMessageListener.instance.onCheckAuth() | ||||
CodeTransformMessageListener.instance.onReauthStarted() | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This Line 608 in ebece9d
instead of waiting/hoping for the user to click on the Re-authenticate button in the notification. |
||||
notifyStickyWarn( | ||||
message("codemodernizer.notification.warn.expired_credentials.title"), | ||||
message("codemodernizer.notification.warn.expired_credentials.content"), | ||||
project, | ||||
listOf( | ||||
NotificationAction.createSimpleExpiring(message("codemodernizer.notification.warn.action.reauthenticate")) { | ||||
CodeTransformMessageListener.instance.onReauthStarted() | ||||
} | ||||
) | ||||
) | ||||
return@waitUntil state | ||||
} finally { | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,12 +30,12 @@ class RetryableOperation<T> { | |
isRetryable: (Exception) -> Boolean = { it is RetryableException }, | ||
errorHandler: (suspend (Exception, Int) -> Nothing), | ||
): T { | ||
while (attempts < MAX_RETRY_ATTEMPTS) { | ||
while (attempts < MAX_ATTEMPTS) { | ||
try { | ||
return operation() | ||
} catch (e: Exception) { | ||
attempts++ | ||
if (attempts >= MAX_RETRY_ATTEMPTS || !isRetryable(e)) { | ||
if (attempts >= MAX_ATTEMPTS || !isRetryable(e)) { | ||
errorHandler.invoke(e, attempts) | ||
} | ||
delay(getJitteredDelay()) | ||
|
@@ -48,6 +48,6 @@ class RetryableOperation<T> { | |
companion object { | ||
private const val INITIAL_DELAY = 100L | ||
private const val MAX_BACKOFF = 10000L | ||
private const val MAX_RETRY_ATTEMPTS = 3 | ||
private const val MAX_ATTEMPTS = 4 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm guessing the intention was to do 3 retries (after the initial attempt), meaning this should technically be set to 4, and naming it |
||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the same retry strategy from:
aws-toolkit-jetbrains/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/clients/AmazonQStreamingClient.kt
Lines 82 to 89 in ebece9d
in the
ExportResultArchive
(download) APIand added
SocketTimeoutException
(which is not a type ofTimeoutException
, so it needs to be explicitly listed here)