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

This commit is contained in:
Torma Kristóf 2020-10-22 02:00:45 +02:00
parent 144452a768
commit 5962a477f4
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -12,19 +12,32 @@ import io.ktor.http.content.*
import io.ktor.util.*
import kotlinx.coroutines.*
import java.io.File
import java.time.Duration
import java.time.Instant
fun main(args: Array<String>): Unit = io.ktor.server.tomcat.EngineMain.main(args)
@KtorExperimentalAPI
@Suppress("unused") // Referenced in application.conf
@Suppress("unused")
@kotlin.jvm.JvmOverloads
fun Application.module(testing: Boolean = false) {
runBlocking {
val cachedFile = File("/app/wave.wav").readBytes()
val gson = GsonBuilder().setPrettyPrinting().create()
uploadData(1, gson, cachedFile)
val startTime = Instant.now()
var elapsed = Duration.ofSeconds(0)
val targetTime = Duration.ofSeconds(10)
var currIter = 1
val timestamps = LinkedHashMap<Int,Instant>()
var currTimeStamp = Instant.now()
while(elapsed > targetTime){
uploadData(currIter, gson, cachedFile)
currIter+=1
currTimeStamp = Instant.now()
timestamps[currIter] = currTimeStamp
elapsed = Duration.between(startTime, currTimeStamp)
}
}
}
@KtorExperimentalAPI