From d81339b851eef80356db2e9a496e924c62a29c65 Mon Sep 17 00:00:00 2001 From: Torma Date: Thu, 22 Oct 2020 02:35:18 +0200 Subject: [PATCH] while only runs if its true --- src/Application.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Application.kt b/src/Application.kt index edc07e7..3e3497a 100644 --- a/src/Application.kt +++ b/src/Application.kt @@ -17,7 +17,7 @@ fun Application.module(testing: Boolean = false) { runBlocking { val cachedFile = File("/app/wave.wav").readBytes() val gson = GsonBuilder().setPrettyPrinting().create() - val startTime = Instant.now() + var startTime : Instant var elapsed = Duration.ofSeconds(0) val targetTime = Duration.ofSeconds(System.getenv("WAITTIME").toLong()) var currIter = 1 @@ -29,7 +29,8 @@ fun Application.module(testing: Boolean = false) { val job = GlobalScope.launch { delay(3000L) println("Starting benchmark") - while(elapsed > targetTime){ + startTime = Instant.now() + while(elapsed < targetTime){ println(currIter) uploader.uploadData(currIter, gson, cachedFile) currIter+=1