diff options
author | Pierre Guillot <50145663+pierre-guillot-sonarsource@users.noreply.github.com> | 2020-12-02 12:25:40 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2020-12-02 20:06:58 +0000 |
commit | 5ca7a4f8b7a5aa33a7638573117fa6ce98578b15 (patch) | |
tree | bf0c8764c6414fbd092d090c5071079731bc6eb0 /server/sonar-webserver-core | |
parent | f354f42d0d5b53c714c6a51c52e017565db3d37e (diff) | |
download | sonarqube-5ca7a4f8b7a5aa33a7638573117fa6ce98578b15.tar.gz sonarqube-5ca7a4f8b7a5aa33a7638573117fa6ce98578b15.zip |
SONAR-13793 improve ncloc count performance by using projects instead of components
Diffstat (limited to 'server/sonar-webserver-core')
2 files changed, 5 insertions, 8 deletions
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java index 0eda7898f94..202835901f8 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java @@ -58,19 +58,18 @@ public class TelemetryDataLoaderImpl implements TelemetryDataLoader { private final UserIndex userIndex; private final ProjectMeasuresIndex projectMeasuresIndex; private final PlatformEditionProvider editionProvider; - private final DefaultOrganizationProvider defaultOrganizationProvider; private final InternalProperties internalProperties; private final DockerSupport dockerSupport; @CheckForNull private final LicenseReader licenseReader; public TelemetryDataLoaderImpl(Server server, DbClient dbClient, PluginRepository pluginRepository, UserIndex userIndex, ProjectMeasuresIndex projectMeasuresIndex, - PlatformEditionProvider editionProvider, DefaultOrganizationProvider defaultOrganizationProvider, InternalProperties internalProperties, DockerSupport dockerSupport) { - this(server, dbClient, pluginRepository, userIndex, projectMeasuresIndex, editionProvider, defaultOrganizationProvider, internalProperties, dockerSupport, null); + PlatformEditionProvider editionProvider, InternalProperties internalProperties, DockerSupport dockerSupport) { + this(server, dbClient, pluginRepository, userIndex, projectMeasuresIndex, editionProvider, internalProperties, dockerSupport, null); } public TelemetryDataLoaderImpl(Server server, DbClient dbClient, PluginRepository pluginRepository, UserIndex userIndex, ProjectMeasuresIndex projectMeasuresIndex, - PlatformEditionProvider editionProvider, DefaultOrganizationProvider defaultOrganizationProvider, InternalProperties internalProperties, + PlatformEditionProvider editionProvider, InternalProperties internalProperties, DockerSupport dockerSupport, @Nullable LicenseReader licenseReader) { this.server = server; this.dbClient = dbClient; @@ -78,7 +77,6 @@ public class TelemetryDataLoaderImpl implements TelemetryDataLoader { this.userIndex = userIndex; this.projectMeasuresIndex = projectMeasuresIndex; this.editionProvider = editionProvider; - this.defaultOrganizationProvider = defaultOrganizationProvider; this.internalProperties = internalProperties; this.dockerSupport = dockerSupport; this.licenseReader = licenseReader; @@ -115,7 +113,6 @@ public class TelemetryDataLoaderImpl implements TelemetryDataLoader { data.setUsingBranches(dbClient.branchDao().hasNonMainBranches(dbSession)); SumNclocDbQuery query = SumNclocDbQuery.builder() .setOnlyPrivateProjects(false) - .setOrganizationUuid(defaultOrganizationProvider.get().getUuid()) .build(); data.setNcloc(dbClient.liveMeasureDao().sumNclocOfBiggestBranch(dbSession, query)); long numberOfUnanalyzedCMeasures = dbClient.liveMeasureDao().countProjectsHavingMeasure(dbSession, UNANALYZED_C_KEY); diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java index 5e47becce65..581b78ee09e 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java @@ -81,9 +81,9 @@ public class TelemetryDataLoaderImplTest { private final LicenseReader licenseReader = mock(LicenseReader.class); private final TelemetryDataLoader communityUnderTest = new TelemetryDataLoaderImpl(server, db.getDbClient(), pluginRepository, new UserIndex(es.client(), system2), - new ProjectMeasuresIndex(es.client(), null, system2), editionProvider, new DefaultOrganizationProviderImpl(db.getDbClient()), internalProperties, dockerSupport, null); + new ProjectMeasuresIndex(es.client(), null, system2), editionProvider, internalProperties, dockerSupport, null); private final TelemetryDataLoader commercialUnderTest = new TelemetryDataLoaderImpl(server, db.getDbClient(), pluginRepository, new UserIndex(es.client(), system2), - new ProjectMeasuresIndex(es.client(), null, system2), editionProvider, new DefaultOrganizationProviderImpl(db.getDbClient()), internalProperties, dockerSupport, licenseReader); + new ProjectMeasuresIndex(es.client(), null, system2), editionProvider, internalProperties, dockerSupport, licenseReader); @Test public void send_telemetry_data() { |