#91 -- Run scheduled time series creators
This commit is contained in:
parent
1dc44f7988
commit
3bb4f5c49c
@ -1,8 +1,3 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Anton Romanov - All Rights Reserved
|
||||
* You may use, distribute and modify this code, please write to: romanov73@gmail.com.
|
||||
*/
|
||||
|
||||
package ru.ulstu.extractor.gitrepository.service;
|
||||
|
||||
import com.sun.istack.NotNull;
|
||||
@ -18,6 +13,7 @@ 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;
|
||||
@ -30,13 +26,16 @@ public class IndexService {
|
||||
private final GitRepositoryService gitRepositoryService;
|
||||
private final BranchService branchService;
|
||||
private final List<DBTimeSeriesCreator> timeSeriesCreators;
|
||||
private final ScheduledTimeSeriesService scheduledTimeSeriesService;
|
||||
|
||||
public IndexService(GitRepositoryService gitRepositoryService,
|
||||
BranchService branchService,
|
||||
List<DBTimeSeriesCreator> timeSeriesCreators) {
|
||||
List<DBTimeSeriesCreator> timeSeriesCreators,
|
||||
ScheduledTimeSeriesService scheduledTimeSeriesService) {
|
||||
this.gitRepositoryService = gitRepositoryService;
|
||||
this.branchService = branchService;
|
||||
this.timeSeriesCreators = timeSeriesCreators;
|
||||
this.scheduledTimeSeriesService = scheduledTimeSeriesService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@ -74,6 +73,7 @@ public class IndexService {
|
||||
branch = branchService.findByBranchId(branch.getId()).orElseThrow(() -> new RuntimeException("Branch not found by id"));
|
||||
final Branch branchForSave = branchService.updateStatus(branch, IndexingStatus.FINISHED);
|
||||
timeSeriesCreators.forEach(tsCreator -> tsCreator.addTimeSeries(branchForSave));
|
||||
scheduledTimeSeriesService.addTimeSeriesPoints();
|
||||
LOG.debug("Complete indexing {} branch", branch.getName());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user