Skip to content

Commit

Permalink
fix(vertx): Use timeunits for max blocking time (#821)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinWitt authored Jul 10, 2023
1 parent 1026247 commit 26dcf19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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()));
}
}
Expand Down

0 comments on commit 26dcf19

Please sign in to comment.