while only runs if its true
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2020-10-22 02:35:18 +02:00
parent 89504a99ca
commit d81339b851
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -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