From 9972f5e925bf0ca43c81ece6c948844c3d0c1393 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Wed, 22 Feb 2023 15:49:10 +0400 Subject: [PATCH] #92 -- Add api call --- .../extractor/gitrepository/service/IndexService.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/ru/ulstu/extractor/gitrepository/service/IndexService.java b/src/main/java/ru/ulstu/extractor/gitrepository/service/IndexService.java index 7345254..d8d1c1e 100644 --- a/src/main/java/ru/ulstu/extractor/gitrepository/service/IndexService.java +++ b/src/main/java/ru/ulstu/extractor/gitrepository/service/IndexService.java @@ -18,12 +18,11 @@ import ru.ulstu.extractor.branch.service.BranchService; import ru.ulstu.extractor.commit.model.Commit; import ru.ulstu.extractor.gitrepository.model.GitRepository; import ru.ulstu.extractor.ts.creator.db.DBTimeSeriesCreator; +import ru.ulstu.extractor.ts.service.ScheduledTimeSeriesService; import java.io.IOException; import java.util.Collections; import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; @Service public class IndexService { @@ -32,14 +31,16 @@ public class IndexService { private final GitRepositoryService gitRepositoryService; private final BranchService branchService; private final List timeSeriesCreators; - private final static ExecutorService EXECUTOR = Executors.newFixedThreadPool(10); + private final ScheduledTimeSeriesService scheduledTimeSeriesService; public IndexService(GitRepositoryService gitRepositoryService, BranchService branchService, - List timeSeriesCreators) { + List timeSeriesCreators, + ScheduledTimeSeriesService scheduledTimeSeriesService) { this.gitRepositoryService = gitRepositoryService; this.branchService = branchService; this.timeSeriesCreators = timeSeriesCreators; + this.scheduledTimeSeriesService = scheduledTimeSeriesService; } @Transactional @@ -78,6 +79,7 @@ public class IndexService { final Branch branchForSave = branchService.updateStatus(branch, IndexingStatus.FINISHED); timeSeriesCreators.forEach(tsCreator -> tsCreator.addTimeSeries(branchForSave)); LOG.debug("Complete indexing {} branch", branch.getName()); + scheduledTimeSeriesService.addTimeSeriesPoints(); } @Transactional