envvars and better structure
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2020-10-22 02:24:36 +02:00
parent c05aabf185
commit 4d0920c40f
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047
2 changed files with 16 additions and 12 deletions

View File

@ -19,13 +19,15 @@ fun Application.module(testing: Boolean = false) {
val gson = GsonBuilder().setPrettyPrinting().create() val gson = GsonBuilder().setPrettyPrinting().create()
val startTime = Instant.now() val startTime = Instant.now()
var elapsed = Duration.ofSeconds(0) var elapsed = Duration.ofSeconds(0)
val targetTime = Duration.ofSeconds(10) val targetTime = Duration.ofSeconds(System.getenv("WAITTIME").toLong())
var currIter = 1 var currIter = 1
val timestamps = LinkedHashMap<Int,Instant>() val timestamps = LinkedHashMap<Int,Instant>()
var currTimeStamp : Instant var currTimeStamp : Instant
val uploader = Uploader() val uploader = Uploader()
val processResults = ProcessResults() val processResults = ProcessResults()
environment.monitor.subscribe(ApplicationStarted) {
println("Starting benchmark") println("Starting benchmark")
val job = GlobalScope.launch {
while(elapsed > targetTime){ while(elapsed > targetTime){
println(currIter) println(currIter)
uploader.uploadData(currIter, gson, cachedFile) uploader.uploadData(currIter, gson, cachedFile)
@ -38,3 +40,5 @@ fun Application.module(testing: Boolean = false) {
processResults.process() processResults.process()
} }
} }
}
}

View File

@ -34,7 +34,7 @@ class Uploader(){
} }
client.submitFormWithBinaryData<Unit>(formData = parts) { client.submitFormWithBinaryData<Unit>(formData = parts) {
url("https://birb.k8s.kmlabz.com/benchmark") url(System.getenv("URL") ?: "https://birb.k8s.kmlabz.com/benchmark")
} }
} }
} }