From 64904612fdfda7aac6fc28203a7bc9646eb81f27 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Thu, 13 Jul 2023 22:07:28 +0200 Subject: [PATCH] feat(vertx): Use more robust time constrained mining instead of result based --- .../laughing_train/mining/AnalyzerResultsPersistence.java | 2 -- .../martinwitt/laughing_train/mining/MiningStartup.java | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/AnalyzerResultsPersistence.java b/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/AnalyzerResultsPersistence.java index 0a6114aa7..4c6187e30 100644 --- a/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/AnalyzerResultsPersistence.java +++ b/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/AnalyzerResultsPersistence.java @@ -5,7 +5,6 @@ import io.github.martinwitt.laughing_train.data.result.CodeAnalyzerResult; import io.github.martinwitt.laughing_train.domain.entity.AnalyzerStatus; import io.github.martinwitt.laughing_train.domain.entity.GitHubCommit; -import io.github.martinwitt.laughing_train.mining.requests.MineNextProject; import io.github.martinwitt.laughing_train.mining.requests.StoreResults; import io.github.martinwitt.laughing_train.persistence.repository.ProjectRepository; import io.vertx.core.AbstractVerticle; @@ -42,7 +41,6 @@ void persistResults(StoreResults storeResults) { } else if (result instanceof CodeAnalyzerResult.Success success) { logger.atInfo().log("Analyzer %s succeeded for project %s", SERVICE_NAME, project.name()); } - eventBus.publish("miner", new MineNextProject(storeResults.analyzerName())); } private AnalyzerStatus getAnalyzerStatus(CodeAnalyzerResult spoonResult, String name) { diff --git a/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/MiningStartup.java b/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/MiningStartup.java index d8ac254b7..8e406eca7 100644 --- a/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/MiningStartup.java +++ b/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/MiningStartup.java @@ -37,9 +37,9 @@ void startup(@Observes StartupEvent event) { System.out.println("Received message: " + v.toString()); v.next(); }); - vertx.setTimer(TimeUnit.MINUTES.toMillis(3), v -> vertx.eventBus() + vertx.setPeriodic(TimeUnit.MINUTES.toMillis(3), TimeUnit.MINUTES.toMillis(25), v -> vertx.eventBus() .publish("miner", new MineNextProject(QodanaPeriodicMiner.ANALYZER_NAME))); - vertx.setTimer(TimeUnit.MINUTES.toMillis(3), v -> vertx.eventBus() + vertx.setPeriodic(TimeUnit.MINUTES.toMillis(3), TimeUnit.MINUTES.toMillis(15), v -> vertx.eventBus() .publish("miner", new MineNextProject(SpoonPeriodicMiner.ANALYZER_NAME))); } }