From 429471c4f319089c5d3a7e9cec20d5ae4aa8949d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Augusto=20C=C3=A9sar=20Dias?= Date: Tue, 5 Dec 2023 08:41:38 +0100 Subject: [PATCH] enable in memory db again --- .../com/wire/kalium/monkeys/homeDirectory.kt | 2 +- .../com/wire/kalium/monkeys/pool/MonkeyPool.kt | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/monkeys/src/main/kotlin/com/wire/kalium/monkeys/homeDirectory.kt b/monkeys/src/main/kotlin/com/wire/kalium/monkeys/homeDirectory.kt index 711967e183a..b41872b1258 100644 --- a/monkeys/src/main/kotlin/com/wire/kalium/monkeys/homeDirectory.kt +++ b/monkeys/src/main/kotlin/com/wire/kalium/monkeys/homeDirectory.kt @@ -34,7 +34,7 @@ fun coreLogic( encryptProteusStorage = true, isMLSSupportEnabled = true, wipeOnDeviceRemoval = true, - ), userAgent = "Wire Infinite Monkeys", useInMemoryStorage = false + ), userAgent = "Wire Infinite Monkeys", useInMemoryStorage = true ) coreLogic.updateApiVersionsScheduler.scheduleImmediateApiVersionUpdate() return coreLogic diff --git a/monkeys/src/main/kotlin/com/wire/kalium/monkeys/pool/MonkeyPool.kt b/monkeys/src/main/kotlin/com/wire/kalium/monkeys/pool/MonkeyPool.kt index 77ad109d5e2..ec6c540c962 100644 --- a/monkeys/src/main/kotlin/com/wire/kalium/monkeys/pool/MonkeyPool.kt +++ b/monkeys/src/main/kotlin/com/wire/kalium/monkeys/pool/MonkeyPool.kt @@ -26,6 +26,9 @@ import com.wire.kalium.monkeys.importer.Team import com.wire.kalium.monkeys.importer.UserCount import com.wire.kalium.monkeys.importer.UserData import io.micrometer.core.instrument.Tag +import kotlinx.coroutines.async +import kotlinx.coroutines.awaitAll +import kotlinx.coroutines.coroutineScope import java.util.concurrent.ConcurrentHashMap import kotlin.math.roundToInt @@ -67,12 +70,14 @@ class MonkeyPool(users: List, testCase: String) { } } - suspend fun warmUp(core: CoreLogic) { + suspend fun warmUp(core: CoreLogic) = coroutineScope { // this is needed to create key packages for clients at least once - poolById.values.forEach { - it.login(core) {} - it.logout {} - } + poolById.values.map { + async { + it.login(core) {} + it.logout {} + } + }.awaitAll() } fun randomMonkeysFromTeam(team: String, userCount: UserCount): List {