From 26dcf19ba5eb1a04f7fa3e9f867748f961a21952 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 10 Jul 2023 23:58:48 +0200 Subject: [PATCH] fix(vertx): Use timeunits for max blocking time (#821) --- .../laughing_train/mining/QodanaPeriodicMiner.java | 6 ++++-- .../laughing_train/mining/SpoonPeriodicMiner.java | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) 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 e6e612333..012546ed6 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 @@ -81,7 +81,8 @@ void mine(@Observes StartupEvent event) { try { logger.atInfo().log("Starting Qodana periodic miner"); vertx.exceptionHandler(it -> logger.atWarning().withCause(it).log("Exception in vertx")); - vertx.setTimer(TimeUnit.MINUTES.toMillis(3), v -> vertx.createSharedWorkerExecutor("MINING", 5, 30L) + vertx.setTimer(TimeUnit.MINUTES.toMillis(3), v -> vertx.createSharedWorkerExecutor( + "MINING", 5, 30L, TimeUnit.MINUTES) .executeBlocking(it -> mineRandomRepo())); } catch (Exception e) { logger.atWarning().withCause(e).log("Failed to repo with Qodana"); @@ -126,7 +127,8 @@ private void mineRandomRepo() { } finally { logger.atInfo().log("Queue size: %s", queue.size()); logger.atInfo().log("Mining next repo in 1 minute"); - vertx.setTimer(TimeUnit.MINUTES.toMillis(1), v -> vertx.createSharedWorkerExecutor("MINING", 5, 30L) + vertx.setTimer(TimeUnit.MINUTES.toMillis(1), v -> vertx.createSharedWorkerExecutor( + "MINING", 5, 30L, TimeUnit.MINUTES) .executeBlocking(it -> mineRandomRepo())); } } 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 d26e3a046..84a19a21a 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 @@ -76,7 +76,8 @@ void mine(@Observes StartupEvent event) { try { logger.atInfo().log("Start mining with spoon"); vertx.exceptionHandler(it -> logger.atWarning().withCause(it).log("Exception in vertx")); - vertx.setTimer(TimeUnit.MINUTES.toMillis(3), v -> vertx.createSharedWorkerExecutor("MINING", 5, 30L) + vertx.setTimer(TimeUnit.MINUTES.toMillis(3), v -> vertx.createSharedWorkerExecutor( + "MINING", 5, 30L, TimeUnit.MINUTES) .executeBlocking(it -> mineRandomRepo())); } catch (Exception e) { logger.atWarning().withCause(e).log("Failed to repo with spoon"); @@ -118,7 +119,8 @@ private void mineRandomRepo() { } finally { logger.atInfo().log("Queue size: %s", queue.size()); logger.atInfo().log("Mining next repo in 1 minute"); - vertx.setTimer(TimeUnit.MINUTES.toMillis(1), v -> vertx.createSharedWorkerExecutor("MINING", 5, 30L) + vertx.setTimer(TimeUnit.MINUTES.toMillis(1), v -> vertx.createSharedWorkerExecutor( + "MINING", 5, 30L, TimeUnit.MINUTES) .executeBlocking(it -> mineRandomRepo())); } }