Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Merge pull request #77 from chzhanpeng/master
Browse files Browse the repository at this point in the history
Core version update and log enhancement
  • Loading branch information
rvema authored Mar 11, 2021
2 parents 89fdd03 + 3cbc9ed commit 2929302
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<description>CodeQuality Collector Microservices currently collects data from Sonar</description>
<url>https://hygieia.github.io/Hygieia/getting_started.html</url>
<packaging>jar</packaging>
<version>3.2.5-SNAPSHOT</version>
<version>3.2.4-SNAPSHOT</version>

<parent>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -45,7 +45,7 @@

<properties>
<!-- Dependencies -->
<com.capitalone.dashboard.core.version>3.14.6</com.capitalone.dashboard.core.version>
<com.capitalone.dashboard.core.version>3.14.9</com.capitalone.dashboard.core.version>
<spring-security.version>4.2.18.RELEASE</spring-security.version>
<tomcat.version>8.5.57</tomcat.version>
<commons-beanutils.version>1.9.4</commons-beanutils.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public String getCron() {
@Override
public void collect(SonarCollector collector) {
long start = System.currentTimeMillis();

int totalProjectCount = 0;
Set<ObjectId> udId = new HashSet<>();
udId.add(collector.getId());
List<SonarProject> existingProjects = sonarProjectRepository.findByCollectorIdIn(udId);
Expand All @@ -143,7 +143,9 @@ public void collect(SonarCollector collector) {

addNewProjects(projects, existingProjects, collector);

refreshData(enabledProjects(collector, instanceUrl), sonarClient);
List<SonarProject> enabledProjects = enabledProjects(collector, instanceUrl);
totalProjectCount = enabledProjects.size();
refreshData(enabledProjects, sonarClient);

// Changelog apis do not exist for sonarqube versions under version 5.0
if (version >= 5.0) {
Expand All @@ -153,10 +155,16 @@ public void collect(SonarCollector collector) {
LOG.error(e);
}
}
log("Finished", start);

}
}
long end = System.currentTimeMillis();
long elapsedSeconds = (end - start) / 1000;
LOG.info(String.format("SonarCollectorTask:collect stop, totalProcessSeconds=%d, totalProjectCount=%d",
elapsedSeconds, totalProjectCount));

collector.setLastExecutionRecordCount(totalProjectCount);
collector.setLastExecutedSeconds(elapsedSeconds);
}

private String getFromListSafely(List<String> ls, int index){
Expand Down

0 comments on commit 2929302

Please sign in to comment.