diff --git a/src/Application.kt b/src/Application.kt index ac0e704..425750b 100644 --- a/src/Application.kt +++ b/src/Application.kt @@ -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() 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 { + currIter += 1 + GlobalScope.launch { uploader.uploadData(currIter) - currIter += 1 currTimeStamp = Instant.now() timestamps[currIter] = currTimeStamp elapsed = Duration.between(startTime, currTimeStamp) } - println("Benchmark ended") - processResults.mapToProcess = timestamps - processResults.process() } + println("Benchmark ended") + processResults.mapToProcess = timestamps + processResults.process() } } } \ No newline at end of file