Skip to content

Commit

Permalink
Add FIXINATOR_MAX_CONCURRENCY setting
Browse files Browse the repository at this point in the history
  • Loading branch information
pfreitag committed Dec 16, 2024
1 parent 54e85a2 commit d06ee7c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,17 @@ You can also set this value by running:

This variable should only be used with the enterprise edition.

### FIXINATOR_MAX_CONCURRENCY `ENTERPRISE EDITION`

The `FIXINATOR_MAX_CONCURRENCY` environment variable specifies the maximum number of
threads to use

You can also set this value by running:

box config set modules.fixinator.max_concurrency=8

The default value is `8`

## .fixinator.json

A `.fixinator.json` configuration file can be placed in the root of a folder to be scanned. For Example:
Expand Down
4 changes: 2 additions & 2 deletions box.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name":"fixinator",
"version":"5.0.0",
"version":"5.0.1",
"author":"Foundeo Inc.",
"location":"foundeo/fixinator#v5.0.0",
"location":"foundeo/fixinator#v5.0.1",
"homepage":"https://fixinator.app/",
"documentation":"https://github.com/foundeo/fixinator/wiki",
"repository":{
Expand Down
4 changes: 4 additions & 0 deletions commands/fixinator.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ component extends="commandbox.system.BaseCommand" excludeFromHelp=false {
fixinatorClient.setAPITimeout(configService.getSetting("modules.fixinator.api_timeout", "35"));
}

if (configService.getSetting("modules.fixinator.max_concurrency", "UNDEFINED") != "UNDEFINED") {
fixinatorClient.setMaxConcurrency(configService.getSetting("modules.fixinator.max_concurrency", "8"));
}

if (arguments.verbose) {
print.greenLine("Fixinator API Server: #fixinatorClient.getAPIURL()#");
}
Expand Down
23 changes: 22 additions & 1 deletion models/fixinator/FixinatorClient.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ component singleton="true" {
variables.apiTimeout = trim(variables.system.getenv("FIXINATOR_API_TIMEOUT"));
}

variables.maxConcurrency = 8;
if (!isNull(variables.system.getenv("FIXINATOR_MAX_CONCURRENCY"))) {
variables.maxConcurrency = trim(variables.system.getenv("FIXINATOR_MAX_CONCURRENCY"));
}

variables.clientUpdate = false;
variables.debugMode = false;

Expand Down Expand Up @@ -138,7 +143,15 @@ component singleton="true" {
}
if (server.keyExists("lucee")) {
//run parallel on lucee
arrayEach(local.batches, processBatch, true, arrayLen(local.batches));
local.concurrency = arrayLen(local.batches);
if (local.concurrency > variables.maxConcurrency) {
local.concurrency = variables.maxConcurrency;
}
//use at least 2 threads, to allow progressbar to update
if (hasProgressBar && local.concurrency < 2) {
local.concurrency = 2;
}
arrayEach(local.batches, processBatch, true, local.concurrency);
} else {
arrayEach(local.batches, processBatch);
}
Expand Down Expand Up @@ -204,6 +217,14 @@ component singleton="true" {
variables.apiTimeout = arguments.apiTimeout;
}

public function getMaxConcurrency() {
return variables.maxConcurrency;
}

public function setMaxConcurrency(numeric maxConcurrency) {
variables.maxConcurrency = arguments.maxConcurrency;
}

public function getLockTimeout() {
return getAPITimeout() + 1;
}
Expand Down

0 comments on commit d06ee7c

Please sign in to comment.