Resolve "Добавить логирование всех действий по индексации" #55

Merged
romanov73 merged 1 commits from 27-logs into master 2021-04-28 09:59:21 +04:00
3 changed files with 3 additions and 3 deletions
Showing only changes of commit 691ea95a1c - Show all commits

View File

@ -20,7 +20,7 @@ import ru.ulstu.extractor.model.Repository;
import java.util.List; import java.util.List;
public interface CommitRepository extends JpaRepository<Commit, Integer> { public interface CommitRepository extends JpaRepository<Commit, Integer> {
@Query("SELECT DISTINCT c FROM Commit c JOIN c.branch b JOIN c.fileChanges f JOIN c.author a JOIN b.repository r WHERE r = :repository AND b.name = :branchName AND (:author IS NULL OR :author = '' OR a.name = :author) AND (:filter IS NULL OR :filter = '' OR lower(c.message) LIKE lower(concat('%', :filter,'%'))) AND (:entity IS NULL OR f.containsEntity = :entity)") @Query("SELECT DISTINCT c FROM Commit c LEFT JOIN c.branch b LEFT JOIN c.fileChanges f LEFT JOIN c.author a LEFT JOIN b.repository r WHERE r = :repository AND b.name = :branchName AND (:author IS NULL OR :author = '' OR a.name = :author) AND (:filter IS NULL OR :filter = '' OR lower(c.message) LIKE lower(concat('%', :filter,'%'))) AND (:entity IS NULL OR f.containsEntity = :entity)")
Page<Commit> findByRepositoryAndBranch(Pageable pageable, @Param("repository") Repository repository, @Param("branchName") String branchName, @Param("author") String author, @Param("filter") String filter, @Param("entity") Boolean entity); Page<Commit> findByRepositoryAndBranch(Pageable pageable, @Param("repository") Repository repository, @Param("branchName") String branchName, @Param("author") String author, @Param("filter") String filter, @Param("entity") Boolean entity);
@Query("SELECT new ru.ulstu.extractor.model.CommitAuthorStatistic(c.author.name, COUNT(DISTINCT c.hash)) FROM Commit c GROUP by c.author.name") @Query("SELECT new ru.ulstu.extractor.model.CommitAuthorStatistic(c.author.name, COUNT(DISTINCT c.hash)) FROM Commit c GROUP by c.author.name")

View File

@ -112,9 +112,8 @@ public class GitRepositoryService {
List<Commit> list = new ArrayList<>(); List<Commit> list = new ArrayList<>();
RevCommit prevCommit = null; RevCommit prevCommit = null;
LOG.debug("Start analyse {} commits", commits.size()); LOG.debug("Start analyse {} commits", commits.size());
commitsFrom = commitsFrom > commits.size() ? commits.size() - 1 : commitsFrom;
commitsFrom = Math.max(commitsFrom, 0); commitsFrom = Math.max(commitsFrom, 0);
commitsTo = commitsTo > commits.size() ? commits.size() - 1 : commitsTo; commitsTo = Math.min(commitsTo, commits.size());
commitsTo = Math.max(commitsTo, 0); commitsTo = Math.max(commitsTo, 0);
for (int i = commitsFrom; i < commitsTo; i++) { for (int i = commitsFrom; i < commitsTo; i++) {
RevCommit revCommit = commits.get(i); RevCommit revCommit = commits.get(i);

View File

@ -58,5 +58,6 @@ public class IndexService {
commitsTo += COMMITS_PAGE_SIZE; commitsTo += COMMITS_PAGE_SIZE;
commits = gitRepositoryService.getCommits(repositoryUrl, branchName, commitsFrom, commitsTo, false); commits = gitRepositoryService.getCommits(repositoryUrl, branchName, commitsFrom, commitsTo, false);
} }
LOG.debug("Complete indexing {} branch", branchName);
} }
} }