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
This commit is contained in:
Claude
2026-03-28 16:15:23 +00:00
parent 0889473c15
commit d299b65c8a
2 changed files with 2 additions and 5 deletions
@@ -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) {
@@ -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()