This commit is contained in:
parent
144452a768
commit
5962a477f4
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user