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