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:
+1
-1
@@ -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) {
|
||||
|
||||
+1
-4
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user