From c4ef0335289012690e68aedd3683cbf594b4c1cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Henning?= <soeren.henning@email.uni-kiel.de>
Date: Sat, 22 Jan 2022 16:34:53 +0100
Subject: [PATCH] Fix recreation ob BenchmarkStateChecker

Additonally, increase sleep and log formatting.
---
 .../theodolite/execution/operator/BenchmarkStateChecker.kt  | 2 +-
 .../theodolite/execution/operator/TheodoliteController.kt   | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/theodolite/src/main/kotlin/theodolite/execution/operator/BenchmarkStateChecker.kt b/theodolite/src/main/kotlin/theodolite/execution/operator/BenchmarkStateChecker.kt
index 40f5b7ddb..6dcfb5826 100644
--- a/theodolite/src/main/kotlin/theodolite/execution/operator/BenchmarkStateChecker.kt
+++ b/theodolite/src/main/kotlin/theodolite/execution/operator/BenchmarkStateChecker.kt
@@ -24,7 +24,7 @@ class BenchmarkStateChecker(
         Thread {
             while (running) {
                 updateBenchmarkStatus()
-                Thread.sleep(100 * 1)
+                Thread.sleep(1000)
             }
         }.start()
     }
diff --git a/theodolite/src/main/kotlin/theodolite/execution/operator/TheodoliteController.kt b/theodolite/src/main/kotlin/theodolite/execution/operator/TheodoliteController.kt
index 2b6f83c76..5f4180b0b 100644
--- a/theodolite/src/main/kotlin/theodolite/execution/operator/TheodoliteController.kt
+++ b/theodolite/src/main/kotlin/theodolite/execution/operator/TheodoliteController.kt
@@ -37,9 +37,9 @@ class TheodoliteController(
      */
     fun run() {
         sleep(5000) // wait until all states are correctly set
+        benchmarkStateChecker.start(true)
         while (true) {
             reconcile()
-            benchmarkStateChecker.start(true)
             sleep(2000)
         }
     }
@@ -98,11 +98,11 @@ class TheodoliteController(
                     }
                 else -> {
                     executionStateHandler.setExecutionState(execution.name, ExecutionState.FAILURE)
-                    logger.warn { "Unexpected execution state, set state to ${ExecutionState.FAILURE.value}" }
+                    logger.warn { "Unexpected execution state, set state to ${ExecutionState.FAILURE.value}." }
                 }
             }
         } catch (e: Exception) {
-                EventCreator().createEvent(
+            EventCreator().createEvent(
                 executionName = execution.name,
                 type = "WARNING",
                 reason = "Execution failed",
-- 
GitLab