Skip to content

Commit

Permalink
fix: Corellium client request retry (#2050)
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-goral authored Jun 29, 2021
1 parent eef1448 commit b7386e1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ package flank.corellium.client.util

import io.ktor.client.features.ServerResponseException
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.mapNotNull
import kotlin.math.pow

suspend inline fun <R> withRetry(crossinline block: suspend () -> R): R =
(0 until 5).mapNotNull { multi ->
(0 until 5).asFlow().mapNotNull { multi ->
try {
block()
} catch (e: ServerResponseException) {
Expand Down
2 changes: 1 addition & 1 deletion flank-scripts/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ shadowJar.apply {
}
}
// <breaking change>.<feature added>.<fix/minor change>
version = "1.9.19"
version = "1.9.20"
group = "com.github.flank"

application {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
package flank.scripts.cli.assemble

import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.flag
import com.github.ajalt.clikt.parameters.options.option
import flank.scripts.ops.assemble.buildFlank

object FlankCommand : CliktCommand(
name = "flank",
help = "Build Flank"
) {
private val dirty: Boolean by option(
"--dirty", "-d",
help = "Do not clean before build"
).flag(
default = false
)

override fun run() {
buildFlank()
buildFlank(clean = !dirty)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardCopyOption

fun buildFlank() {
fun buildFlank(clean: Boolean = true) {
createGradleCommand(
workingDir = rootDirectoryPathString,
"-p", rootDirectoryPathString, ":test_runner:clean", ":test_runner:assemble", ":test_runner:shadowJar"
)
.runCommand()

"-p", rootDirectoryPathString,
":test_runner:clean".takeIf { clean },
":test_runner:assemble",
":test_runner:shadowJar"
).runCommand()
copyFlankOutputFile()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import java.nio.file.Paths

fun createGradleCommand(
workingDir: String,
vararg options: String
) = createGradleCommand(workingDir, options.asList())
vararg options: String?
) = createGradleCommand(workingDir, options.asList().filterNotNull())

fun createGradleCommand(
workingDir: String,
Expand Down

0 comments on commit b7386e1

Please sign in to comment.