diff --git a/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/QodanaPeriodicMiner.java b/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/QodanaPeriodicMiner.java index ad2f1fd81..77b460f8c 100644 --- a/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/QodanaPeriodicMiner.java +++ b/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/QodanaPeriodicMiner.java @@ -13,6 +13,7 @@ import io.github.martinwitt.laughing_train.services.ProjectService; import io.github.martinwitt.laughing_train.services.QodanaService; import io.micrometer.core.instrument.MeterRegistry; +import io.quarkus.arc.Unremovable; import io.quarkus.runtime.StartupEvent; import io.vertx.core.Vertx; import jakarta.enterprise.context.ApplicationScoped; @@ -28,6 +29,7 @@ import org.kohsuke.github.GHRepository; import org.kohsuke.github.GitHub; +@Unremovable @ApplicationScoped public class QodanaPeriodicMiner { @@ -76,11 +78,13 @@ private Project getKnownProject() { } void mine(@Observes StartupEvent event) { + logger.atInfo().log("Starting Qodana periodic miner"); vertx.setTimer(TimeUnit.MINUTES.toMillis(5), v -> vertx.executeBlocking(it -> mineRandomRepo())); } private void mineRandomRepo() { try { + logger.atInfo().log("Mining repository with qodana"); var project = queue.isEmpty() ? getRandomProject() : queue.poll(); var checkoutResult = checkoutProject(project); if (checkoutResult instanceof ProjectResult.Error) { diff --git a/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/SpoonPeriodicMiner.java b/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/SpoonPeriodicMiner.java index f5fc1cf8d..f2f4dcc0c 100644 --- a/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/SpoonPeriodicMiner.java +++ b/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/SpoonPeriodicMiner.java @@ -11,9 +11,9 @@ import io.github.martinwitt.laughing_train.domain.entity.Project; import io.github.martinwitt.laughing_train.persistence.repository.ProjectRepository; import io.github.martinwitt.laughing_train.services.ProjectService; -import io.github.martinwitt.laughing_train.services.QodanaService; import io.github.martinwitt.laughing_train.services.SpoonAnalyzerService; import io.micrometer.core.instrument.MeterRegistry; +import io.quarkus.arc.Unremovable; import io.quarkus.runtime.StartupEvent; import io.vertx.core.Vertx; import jakarta.enterprise.context.ApplicationScoped; @@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit; import org.apache.commons.io.FileUtils; +@Unremovable @ApplicationScoped public abstract class SpoonPeriodicMiner { @@ -46,7 +47,6 @@ public SpoonPeriodicMiner( Vertx vertx, SearchProjectService searchProjectService, ProjectRepository projectRepository, - QodanaService qodanaService, ProjectService projectService, MiningPrinter miningPrinter, SpoonAnalyzerService spoonAnalyzerService) { @@ -73,11 +73,13 @@ private Project getKnownProject() { } void mine(@Observes StartupEvent event) { + logger.atInfo().log("Start mining with spoon"); vertx.setTimer(TimeUnit.MINUTES.toMillis(5), v -> vertx.executeBlocking(it -> mineRandomRepo())); } private void mineRandomRepo() { try { + logger.atInfo().log("Start mining with spoon"); var project = queue.isEmpty() ? getRandomProject() : queue.poll(); var checkoutResult = checkoutProject(project); if (checkoutResult instanceof ProjectResult.Error) { @@ -85,7 +87,6 @@ private void mineRandomRepo() { mineRandomRepo(); return; } - if (checkoutResult instanceof ProjectResult.Success success) { String commitHash = success.project().commitHash(); if (isAlreadyMined(success, commitHash, ANALYZER_NAME)) { diff --git a/github-bot/src/main/java/io/github/martinwitt/laughing_train/persistence/DataBaseMigration.java b/github-bot/src/main/java/io/github/martinwitt/laughing_train/persistence/DataBaseMigration.java index 12d534a0a..1b1ffc8ba 100644 --- a/github-bot/src/main/java/io/github/martinwitt/laughing_train/persistence/DataBaseMigration.java +++ b/github-bot/src/main/java/io/github/martinwitt/laughing_train/persistence/DataBaseMigration.java @@ -2,7 +2,6 @@ import com.google.common.flogger.FluentLogger; import com.mongodb.client.model.Filters; -import com.mongodb.client.result.DeleteResult; import io.github.martinwitt.laughing_train.domain.entity.Project; import io.github.martinwitt.laughing_train.domain.entity.ProjectConfig; import io.github.martinwitt.laughing_train.persistence.impl.MongoBadSmellRepository; @@ -68,7 +67,6 @@ private void migrateDataBase(Promise promise) { removeProjectHashesWithoutResults(); removeProjectsWithOutHashes(); removeDuplicatedProjects(); - removeBadSmellsFromSpoon(); logger.atInfo().log("Finished migrating database"); promise.complete(); } @@ -122,12 +120,4 @@ private void removeDuplicatedProjects() { .forEach(project -> projectRepository.deleteByProjectUrl(project.getProjectUrl())); logger.atInfo().log("Finished removing duplicated projects"); } - - private void removeBadSmellsFromSpoon() { - logger.atInfo().log("Removing bad smells from spoon"); - DeleteResult deleteMany = - badSmellRepositoryImpl.mongoCollection().deleteMany(Filters.eq("analyzer", "SpoonAnalyzer")); - ; - logger.atInfo().log("Finished removing bad smells from spoon" + deleteMany); - } }