use old behavior
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2020-10-22 02:55:31 +02:00
parent 233b706d29
commit b285769cfd
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -17,22 +17,21 @@ fun Application.module(testing: Boolean = false) {
runBlocking {
val cachedFile = File("/app/wave.wav").readBytes()
val gson = GsonBuilder().setPrettyPrinting().create()
var startTime: Instant
var startTime : Instant
var elapsed = Duration.ofSeconds(0)
val targetTime = Duration.ofSeconds(System.getenv("WAITTIME").toLong())
var currIter = 1
val timestamps = LinkedHashMap<Int, Instant>()
var currTimeStamp: Instant
val timestamps = LinkedHashMap<Int,Instant>()
var currTimeStamp : Instant
val uploader = Uploader()
val processResults = ProcessResults()
environment.monitor.subscribe(ApplicationStarted) {
val job = GlobalScope.launch {
println("Starting benchmark")
startTime = Instant.now()
while (elapsed < targetTime) {
GlobalScope.launch {
while(elapsed < targetTime){
uploader.uploadData(currIter, gson, cachedFile)
}
currIter += 1
currIter+=1
currTimeStamp = Instant.now()
timestamps[currIter] = currTimeStamp
elapsed = Duration.between(startTime, currTimeStamp)
@ -40,7 +39,7 @@ fun Application.module(testing: Boolean = false) {
println("Benchmark ended")
processResults.mapToProcess = timestamps
processResults.process()
}
}
}
}