diff --git a/README.md b/README.md index 8b462e2..332ad2a 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,17 @@ You can also set this value by running: This variable should only be used with the enterprise edition otherwise you may run into issues. +### FIXINATOR_API_TIMEOUT `ENTERPRISE EDITION` + +The `FIXINATOR_API_TIMEOUT` environment variables specifies the http timeout for connecting to the +fixinator api server. + +You can also set this value by running: + + box config set modules.fixinator.api_timeout=35 + +This variable should only be used with the enterprise edition. + ## .fixinator.json A `.fixinator.json` configuration file can be placed in the root of a folder to be scanned. For Example: diff --git a/box.json b/box.json index d20a4fa..a46ff29 100644 --- a/box.json +++ b/box.json @@ -1,8 +1,8 @@ { "name":"fixinator", - "version":"3.0.4", + "version":"3.0.5", "author":"Foundeo Inc.", - "location":"foundeo/fixinator#v3.0.4", + "location":"foundeo/fixinator#v3.0.5", "homepage":"https://fixinator.app/", "documentation":"https://github.com/foundeo/fixinator/wiki", "repository":{ diff --git a/commands/fixinator.cfc b/commands/fixinator.cfc index c238cd0..181c3c1 100644 --- a/commands/fixinator.cfc +++ b/commands/fixinator.cfc @@ -172,6 +172,10 @@ component extends="commandbox.system.BaseCommand" excludeFromHelp=false { fixinatorClient.setMaxPayloadFileCount(configService.getSetting("modules.fixinator.max_payload_file_count", "UNDEFINED")); } + if (configService.getSetting("modules.fixinator.api_timeout", "UNDEFINED") != "UNDEFINED") { + fixinatorClient.setAPITimeout(configService.getSetting("modules.fixinator.api_timeout", "35")); + } + if (arguments.verbose) { print.greenLine("Fixinator API Server: #fixinatorClient.getAPIURL()#"); } @@ -413,7 +417,7 @@ component extends="commandbox.system.BaseCommand" excludeFromHelp=false { local.resultIndex++; local.rFile = listGetAt(arguments.resultFile, local.resultIndex); local.rFile = fileSystemUtil.resolvePath( local.rFile ); - fixinatorReport.generateReport(resultFile=local.rFile, format=local.rFormat, listBy=arguments.listBy, data=local.results); + fixinatorReport.generateReport(resultFile=local.rFile, format=local.rFormat, listBy=arguments.listBy, data=local.results, fixinatorClientVersion=fixinatorClient.getClientVersion()); } } diff --git a/models/fixinator/FixinatorClient.cfc b/models/fixinator/FixinatorClient.cfc index 1abc7b4..8acdea8 100644 --- a/models/fixinator/FixinatorClient.cfc +++ b/models/fixinator/FixinatorClient.cfc @@ -16,6 +16,11 @@ component singleton="true" { variables.apiURL = trim(variables.system.getenv("FIXINATOR_API_URL")); } + variables.apiTimeout = 35; + if (!isNull(variables.system.getenv("FIXINATOR_API_TIMEOUT"))) { + variables.apiTimeout = trim(variables.system.getenv("FIXINATOR_API_TIMEOUT")); + } + variables.clientUpdate = false; variables.debugMode = false; @@ -183,6 +188,18 @@ component singleton="true" { variables.apiURL = arguments.apiURL; } + public function getAPITimeout() { + return variables.apiTimeout; + } + + public function setAPITimeout(numeric apiTimeout) { + variables.apiTimeout = arguments.apiTimeout; + } + + public function getLockTimeout() { + return getAPITimeout() + 1; + } + public function setMaxPayloadSize(numeric size) { variables.maxPayloadSize = arguments.size; } @@ -197,7 +214,7 @@ component singleton="true" { //progress bar worker for (local.i=0;i<1000;i++) { updateProgressBar(element); - cflock(name=element.lock_name, type="readonly", timeout="30") { + cflock(name=element.lock_name, type="readonly", timeout=getLockTimeout()) { if (variables.fixinator_shared[element.lock_name].error != 0) { //thread errored out return; @@ -220,7 +237,7 @@ component singleton="true" { local.payload = {"config"=element.config, "files"=[], "categories":element.categories}; for (local.f in element.files) { - cflock(name=element.lock_name, type="exclusive", timeout="30") { + cflock(name=element.lock_name, type="exclusive", timeout=getLockTimeout()) { variables.fixinator_shared[element.lock_name].fileCounter++; if (variables.fixinator_shared[element.lock_name].error != 0) { //another thread errored out so quit @@ -239,12 +256,12 @@ component singleton="true" { } else { if (local.size + local.fileInfo.size > variables.maxPayloadSize || arrayLen(payload.files) > variables.maxPayloadFileCount) { - cflock(name=element.lock_name, type="exclusive", timeout="30") { + cflock(name=element.lock_name, type="exclusive", timeout=getLockTimeout()) { variables.fixinator_shared[element.lock_name].pendingCounter+=arrayLen(payload.files); } local.result = sendPayload(payload); - cflock(name=element.lock_name, type="exclusive", timeout="30") { + cflock(name=element.lock_name, type="exclusive", timeout=getLockTimeout()) { variables.fixinator_shared[element.lock_name].pendingCounter-=arrayLen(payload.files); } arrayAppend(element.results.results, local.result.results, true); @@ -266,11 +283,11 @@ component singleton="true" { } } if (arrayLen(payload.files)) { - cflock(name=element.lock_name, type="exclusive", timeout="30") { + cflock(name=element.lock_name, type="exclusive", timeout=getLockTimeout()) { variables.fixinator_shared[element.lock_name].pendingCounter+=arrayLen(payload.files); } local.result = sendPayload(payload); - cflock(name=element.lock_name, type="exclusive", timeout="30") { + cflock(name=element.lock_name, type="exclusive", timeout=getLockTimeout()) { variables.fixinator_shared[element.lock_name].pendingCounter-=arrayLen(payload.files); } payload.result = local.result; @@ -283,7 +300,7 @@ component singleton="true" { } catch (any e) { element.error = e; - cflock(name=element.lock_name, type="exclusive", timeout="30") { + cflock(name=element.lock_name, type="exclusive", timeout=getLockTimeout()) { variables.fixinator_shared[element.lock_name].error+=1; } } @@ -296,7 +313,7 @@ component singleton="true" { local.fileCounter = 0; local.pendingCounter = 0; local.totalFileCount = 0; - cflock(name=element.lock_name, type="readonly", timeout="30") { + cflock(name=element.lock_name, type="readonly", timeout=getLockTimeout()) { local.lastPercentValue = variables.fixinator_shared[element.lock_name].lastPercentValue; local.fileCounter = variables.fixinator_shared[element.lock_name].fileCounter; local.pendingCounter = variables.fixinator_shared[element.lock_name].pendingCounter; @@ -323,7 +340,7 @@ component singleton="true" { } if (local.lastPercentValue != local.percentValue) { - cflock(name=element.lock_name, type="exclusive", timeout="30") { + cflock(name=element.lock_name, type="exclusive", timeout=getLockTimeout()) { variables.fixinator_shared[element.lock_name].lastPercentValue = local.percentValue; } } @@ -362,7 +379,7 @@ component singleton="true" { debugger("Payload Paths #local.payloadID#: #serializeJSON(local.payloadPaths)#"); local.tick = getTickCount(); } - cfhttp(url=getAPIURL(), method="POST", result="httpResult", timeout="35") { + cfhttp(url=getAPIURL(), method="POST", result="httpResult", timeout=getAPITimeout()) { cfhttpparam(type="header", name="Content-Type", value="application/json"); cfhttpparam(type="header", name="x-api-key", value=getAPIKey()); cfhttpparam(type="header", name="X-Client-Version", value=getClientVersion()); diff --git a/models/fixinator/FixinatorReport.cfc b/models/fixinator/FixinatorReport.cfc index 6bf9b34..6e38ea9 100644 --- a/models/fixinator/FixinatorReport.cfc +++ b/models/fixinator/FixinatorReport.cfc @@ -12,6 +12,10 @@ + + + + @@ -331,9 +335,18 @@ - + + + + + + + + + +