Skip to content

Commit

Permalink
Correct logic for determining # of threads to run with
Browse files Browse the repository at this point in the history
Should use the minimum of 8 and #cores, not max. If we have 12 cores, we want to only use 8 of them. If we have 4 cores, we want to use 4 cores. Current logic is running with far too many threads, different to documentation.
  • Loading branch information
chadlwilson committed Jul 17, 2023
1 parent 01dc798 commit 37c5158
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ plugins {
}

group = 'cd.go.gocd'
version = '1.0.3'
version = '1.0.4'

project.ext.projectDesc = [
id : 'cd.go.gocd.gocd-database-migrator',
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/thoughtworks/go/dbsync/cli/Args.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class Args {
public boolean progress = false;

@Parameter(names = {"--threads", "-t"}, description = "Number of import threads. Defaults to number of processors (max of 8).", order = 1400)
public int threads = Math.max(8, Runtime.getRuntime().availableProcessors());
public int threads = Math.min(8, Runtime.getRuntime().availableProcessors());

@Parameter(names = {"--export-timeout"}, description = "Number of seconds to allow data to by exported from source to target database before timing out.", order = 1500)
public long exportTimeoutSeconds = TimeUnit.MINUTES.toSeconds(30);
Expand Down

0 comments on commit 37c5158

Please sign in to comment.