From 8713fb04c5f5cf616924b82b3a961d72573a2516 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 2 Aug 2024 23:02:24 +0600 Subject: [PATCH] small change in MapWriteKeyValuesRepo.set and remove duration of FullKeyValuesCacheRepoTests.creatingWorksProperly --- .../commonTest/kotlin/full/FullKeyValuesCacheRepoTests.kt | 2 +- .../kotlin/dev/inmo/micro_utils/repos/MapKeyValuesRepo.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/repos/cache/src/commonTest/kotlin/full/FullKeyValuesCacheRepoTests.kt b/repos/cache/src/commonTest/kotlin/full/FullKeyValuesCacheRepoTests.kt index 4a83b6874e0..c92a1a44881 100644 --- a/repos/cache/src/commonTest/kotlin/full/FullKeyValuesCacheRepoTests.kt +++ b/repos/cache/src/commonTest/kotlin/full/FullKeyValuesCacheRepoTests.kt @@ -10,7 +10,7 @@ import kotlin.test.* class FullKeyValuesCacheRepoTests { @Test - fun creatingWorksProperly() = runTest(timeout = 1.days) { + fun creatingWorksProperly() = runTest { val testData = (0 until 1000).associate { ("$it-" + uuid4().toString()) to (0 until 1000).map { "$it-" + uuid4().toString() diff --git a/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapKeyValuesRepo.kt b/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapKeyValuesRepo.kt index fb9bc5d8a7f..3a004120f92 100644 --- a/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapKeyValuesRepo.kt +++ b/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapKeyValuesRepo.kt @@ -110,9 +110,9 @@ class MapWriteKeyValuesRepo( override suspend fun set(toSet: Map>) { locker.withWriteLock { - toSet.forEach { - map[it.key] = it.value.toMutableList() - } + map.putAll( + toSet.mapValues { it.value.toMutableList() } + ) } toSet.forEach { (k, v) -> v.forEach {