Unverified Commit 771b0f2d authored by Russell Cohen's avatar Russell Cohen Committed by GitHub
Browse files

increase format timeout to 20 seconds (#547)

* increase format timeout to 20 seconds

I observed some failures to format when codegenerating all AWS services due to timeout.

* make timeout configurable

* add default param
parent 45680805
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ class CodegenVisitor(context: PluginContext, private val codegenDecorator: RustC
            )
        )
        try {
            "cargo fmt".runCommand(fileManifest.baseDir, timeout = 10)
            "cargo fmt".runCommand(fileManifest.baseDir, timeout = settings.codegenConfig.formatTimeoutSeconds.toLong())
        } catch (err: CommandFailed) {
            logger.warning("Failed to run cargo fmt: [${service.id}]\n${err.output}")
        }
+3 −2
Original line number Diff line number Diff line
@@ -28,13 +28,14 @@ private const val RUNTIME_CONFIG = "runtimeConfig"
private const val CODEGEN_SETTINGS = "codegen"
private const val LICENSE = "license"

data class CodegenConfig(val renameExceptions: Boolean = true, val includeFluentClient: Boolean = true) {
data class CodegenConfig(val renameExceptions: Boolean = true, val includeFluentClient: Boolean = true, val formatTimeoutSeconds: Int = 20) {
    companion object {
        fun fromNode(node: Optional<ObjectNode>): CodegenConfig {
            return if (node.isPresent) {
                CodegenConfig(
                    node.get().getBooleanMemberOrDefault("renameErrors", true),
                    node.get().getBooleanMemberOrDefault("includeFluentClient", true)
                    node.get().getBooleanMemberOrDefault("includeFluentClient", true),
                    node.get().getNumberMemberOrDefault("formatTimeoutSeconds", 20).toInt()
                )
            } else {
                CodegenConfig()