Skip to content

Commit d06ee7c

Browse files
committed
Add FIXINATOR_MAX_CONCURRENCY setting
1 parent 54e85a2 commit d06ee7c

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,17 @@ You can also set this value by running:
146146

147147
This variable should only be used with the enterprise edition.
148148

149+
### FIXINATOR_MAX_CONCURRENCY `ENTERPRISE EDITION`
150+
151+
The `FIXINATOR_MAX_CONCURRENCY` environment variable specifies the maximum number of
152+
threads to use
153+
154+
You can also set this value by running:
155+
156+
box config set modules.fixinator.max_concurrency=8
157+
158+
The default value is `8`
159+
149160
## .fixinator.json
150161

151162
A `.fixinator.json` configuration file can be placed in the root of a folder to be scanned. For Example:

box.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name":"fixinator",
3-
"version":"5.0.0",
3+
"version":"5.0.1",
44
"author":"Foundeo Inc.",
5-
"location":"foundeo/fixinator#v5.0.0",
5+
"location":"foundeo/fixinator#v5.0.1",
66
"homepage":"https://fixinator.app/",
77
"documentation":"https://github.com/foundeo/fixinator/wiki",
88
"repository":{

commands/fixinator.cfc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ component extends="commandbox.system.BaseCommand" excludeFromHelp=false {
178178
fixinatorClient.setAPITimeout(configService.getSetting("modules.fixinator.api_timeout", "35"));
179179
}
180180

181+
if (configService.getSetting("modules.fixinator.max_concurrency", "UNDEFINED") != "UNDEFINED") {
182+
fixinatorClient.setMaxConcurrency(configService.getSetting("modules.fixinator.max_concurrency", "8"));
183+
}
184+
181185
if (arguments.verbose) {
182186
print.greenLine("Fixinator API Server: #fixinatorClient.getAPIURL()#");
183187
}

models/fixinator/FixinatorClient.cfc

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ component singleton="true" {
2121
variables.apiTimeout = trim(variables.system.getenv("FIXINATOR_API_TIMEOUT"));
2222
}
2323

24+
variables.maxConcurrency = 8;
25+
if (!isNull(variables.system.getenv("FIXINATOR_MAX_CONCURRENCY"))) {
26+
variables.maxConcurrency = trim(variables.system.getenv("FIXINATOR_MAX_CONCURRENCY"));
27+
}
28+
2429
variables.clientUpdate = false;
2530
variables.debugMode = false;
2631

@@ -138,7 +143,15 @@ component singleton="true" {
138143
}
139144
if (server.keyExists("lucee")) {
140145
//run parallel on lucee
141-
arrayEach(local.batches, processBatch, true, arrayLen(local.batches));
146+
local.concurrency = arrayLen(local.batches);
147+
if (local.concurrency > variables.maxConcurrency) {
148+
local.concurrency = variables.maxConcurrency;
149+
}
150+
//use at least 2 threads, to allow progressbar to update
151+
if (hasProgressBar && local.concurrency < 2) {
152+
local.concurrency = 2;
153+
}
154+
arrayEach(local.batches, processBatch, true, local.concurrency);
142155
} else {
143156
arrayEach(local.batches, processBatch);
144157
}
@@ -204,6 +217,14 @@ component singleton="true" {
204217
variables.apiTimeout = arguments.apiTimeout;
205218
}
206219

220+
public function getMaxConcurrency() {
221+
return variables.maxConcurrency;
222+
}
223+
224+
public function setMaxConcurrency(numeric maxConcurrency) {
225+
variables.maxConcurrency = arguments.maxConcurrency;
226+
}
227+
207228
public function getLockTimeout() {
208229
return getAPITimeout() + 1;
209230
}

0 commit comments

Comments
 (0)