mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
rename withRetry to withRetryBlocking — avoid errors line nested runBlocking calls
GitOrigin-RevId: c2e9817344c3ce07ec236b3e56ae57975d830cc1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
289da42fad
commit
dff1750f62
+2
-2
@@ -3,7 +3,7 @@
|
||||
package com.intellij.tools.ide.metrics.collector.telemetry
|
||||
|
||||
import com.intellij.tools.ide.util.common.PrintFailuresMode
|
||||
import com.intellij.tools.ide.util.common.withRetry
|
||||
import com.intellij.tools.ide.util.common.withRetryBlocking
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectFunction
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap
|
||||
import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet
|
||||
@@ -33,7 +33,7 @@ private data class OpentelemetryJsonData(
|
||||
)
|
||||
|
||||
private fun getSpans(file: Path): List<SpanData> {
|
||||
val spanData = withRetry(
|
||||
val spanData = withRetryBlocking(
|
||||
messageOnFailure = "Failure during spans extraction from OpenTelemetry json file",
|
||||
retries = 5,
|
||||
printFailuresMode = PrintFailuresMode.ONLY_LAST_FAILURE,
|
||||
|
||||
+7
-7
@@ -16,11 +16,11 @@ enum class PrintFailuresMode {
|
||||
|
||||
|
||||
/** @return T - if successful; null - otherwise */
|
||||
suspend fun <T> withRetryAsync(messageOnFailure: String,
|
||||
retries: Long = 3,
|
||||
printFailuresMode: PrintFailuresMode = PrintFailuresMode.ALL_FAILURES,
|
||||
delay: Duration = 10.seconds,
|
||||
retryAction: suspend () -> T): T? {
|
||||
suspend fun <T> withRetry(messageOnFailure: String,
|
||||
retries: Long = 3,
|
||||
printFailuresMode: PrintFailuresMode = PrintFailuresMode.ALL_FAILURES,
|
||||
delay: Duration = 10.seconds,
|
||||
retryAction: suspend () -> T): T? {
|
||||
|
||||
(1..retries).forEach { failureCount ->
|
||||
try {
|
||||
@@ -57,14 +57,14 @@ open class NoRetryException(message: String, cause: Throwable?) : IllegalStateEx
|
||||
|
||||
/** @return T - if successful; null - otherwise */
|
||||
@Suppress("RAW_RUN_BLOCKING")
|
||||
fun <T> withRetry(
|
||||
fun <T> withRetryBlocking(
|
||||
messageOnFailure: String,
|
||||
retries: Long = 3,
|
||||
printFailuresMode: PrintFailuresMode = PrintFailuresMode.ALL_FAILURES,
|
||||
delay: Duration = 10.seconds,
|
||||
retryAction: () -> T
|
||||
): T? = runBlocking(Dispatchers.IO) {
|
||||
withRetryAsync(
|
||||
withRetry(
|
||||
messageOnFailure = messageOnFailure,
|
||||
retries = retries,
|
||||
printFailuresMode = printFailuresMode,
|
||||
|
||||
Reference in New Issue
Block a user