oops
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2020-10-22 19:35:01 +02:00
parent a212aa300c
commit f3d339a4a6
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -1,10 +1,8 @@
package com.kmlabz.k8s
import com.google.gson.GsonBuilder
import io.ktor.application.*
import io.ktor.util.*
import kotlinx.coroutines.*
import java.io.File
import java.time.Duration
import java.time.Instant
@ -18,7 +16,7 @@ fun Application.module(testing: Boolean = false) {
var startTime: Instant
var elapsed = Duration.ofSeconds(0)
val targetTime = Duration.ofSeconds(System.getenv("WAITTIME").toLong())
var currIter = 1
var currIter = 0
val timestamps = LinkedHashMap<Int, Instant>()
var currTimeStamp: Instant
val uploader = Uploader()
@ -27,17 +25,17 @@ fun Application.module(testing: Boolean = false) {
println("Starting benchmark")
startTime = Instant.now()
while (elapsed < targetTime) {
val job = GlobalScope.launch {
uploader.uploadData(currIter)
currIter += 1
GlobalScope.launch {
uploader.uploadData(currIter)
currTimeStamp = Instant.now()
timestamps[currIter] = currTimeStamp
elapsed = Duration.between(startTime, currTimeStamp)
}
}
println("Benchmark ended")
processResults.mapToProcess = timestamps
processResults.process()
}
}
}
}