From d299b65c8a787a6d6fa461b25aab9b24ece089f8 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Mar 2026 16:15:23 +0000 Subject: [PATCH] feat: make forEachDB action suspending, remove redundant runBlocking Change the action lambda to `suspend (EventStore) -> Unit` so callers can use suspend functions directly. Remove the now-unnecessary runBlocking wrapper around delay() in ExpirationTest. https://claude.ai/code/session_01TQRzVTAXBVWRGstcsapA5F --- .../quartz/nip01Core/store/sqlite/BaseDBTest.kt | 2 +- .../quartz/nip01Core/store/sqlite/ExpirationTest.kt | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/BaseDBTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/BaseDBTest.kt index f4e3173ca..300ceb4cc 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/BaseDBTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/BaseDBTest.kt @@ -75,7 +75,7 @@ open class BaseDBTest { dbs.forEach { it.value.close() } } - fun forEachDB(action: (EventStore) -> Unit) = + fun forEachDB(action: suspend (EventStore) -> Unit) = runBlocking { dbs.forEach { (key, value) -> launch(Dispatchers.Default) { diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/ExpirationTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/ExpirationTest.kt index fcd90af04..793470e3b 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/ExpirationTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/ExpirationTest.kt @@ -27,7 +27,6 @@ import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip40Expiration.expiration import com.vitorpamplona.quartz.utils.TimeUtils import kotlinx.coroutines.delay -import kotlinx.coroutines.runBlocking import kotlin.test.Test import kotlin.test.assertFailsWith @@ -59,9 +58,7 @@ class ExpirationTest : BaseDBTest() { db.assertQuery(noteToExpire, Filter(ids = listOf(noteToExpire.id))) - runBlocking { - delay(2000) - } + delay(2000) db.deleteExpiredEvents()