Skip to content

Commit 203ecbb

Browse files
committed
fix for format errors.
1 parent e39fcc5 commit 203ecbb

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/util/CodeWhispererZipUploadManager.kt

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,7 @@ class CodeWhispererZipUploadManager(private val project: Project) {
111111
},
112112
isRetryable = { e ->
113113
when (e) {
114-
is IOException,
115-
is SocketException,
116-
is SocketTimeoutException,
117-
-> true
114+
is SocketException, is SocketTimeoutException, is IOException -> true
118115
else -> false
119116
}
120117
},
@@ -216,24 +213,24 @@ fun getTelemetryErrorMessage(e: Exception, featureUseCase: CodeWhispererConstant
216213

217214
class RetryableOperation<T> {
218215
private var attempts = 0
219-
private var currentDelay = initialDelay
216+
private var currentDelay = INITIAL_DELAY
220217
private var lastException: Exception? = null
221218

222219
fun execute(
223220
operation: () -> T,
224221
isRetryable: (Exception) -> Boolean,
225222
errorHandler: (Exception, Int) -> Nothing,
226223
): T {
227-
while (attempts < maxRetryAttempts) {
224+
while (attempts < MAX_RETRY_ATTEMPTS) {
228225
try {
229226
return operation()
230227
} catch (e: Exception) {
231228
lastException = e
232229

233230
attempts++
234-
if (attempts < maxRetryAttempts && isRetryable(e)) {
231+
if (attempts < MAX_RETRY_ATTEMPTS && isRetryable(e)) {
235232
Thread.sleep(currentDelay)
236-
currentDelay = (currentDelay * 2).coerceAtMost(maxBackoff)
233+
currentDelay = (currentDelay * 2).coerceAtMost(MAX_BACKOFF)
237234
continue
238235
}
239236

@@ -246,8 +243,8 @@ class RetryableOperation<T> {
246243
}
247244

248245
companion object {
249-
private const val initialDelay = 100L // milliseconds
250-
private const val maxBackoff = 10000L // milliseconds
251-
private const val maxRetryAttempts = 3
246+
private const val INITIAL_DELAY = 100L // milliseconds
247+
private const val MAX_BACKOFF = 10000L // milliseconds
248+
private const val MAX_RETRY_ATTEMPTS = 3
252249
}
253250
}

0 commit comments

Comments
 (0)