Adds a flatten to set utility

This commit is contained in:
Vitor Pamplona
2025-10-31 18:36:05 -04:00
parent 95cc0783fd
commit 3eb662851b
7 changed files with 23 additions and 8 deletions

View File

@@ -31,6 +31,7 @@ import com.vitorpamplona.quartz.nip01Core.store.sqlite.EventStore
import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent
import com.vitorpamplona.quartz.nip40Expiration.isExpired
import com.vitorpamplona.quartz.utils.Log
import com.vitorpamplona.quartz.utils.flattenToSet
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -72,8 +73,8 @@ class LargeDBInsertBenchmark : BaseLargeCacheBenchmark() {
fun bench40DeletionRequestsEvents() {
val context = ApplicationProvider.getApplicationContext<Context>()
val deletions = allEvents.filterIsInstance<DeletionEvent>()
val deletionIds = deletions.map { it.deleteEventIds() }.flatten().toSet()
val deletionAddresses = deletions.map { it.deleteAddressIds() }.flatten().toSet()
val deletionIds = deletions.map { it.deleteEventIds() }.flattenToSet()
val deletionAddresses = deletions.map { it.deleteAddressIds() }.flattenToSet()
val toBeDeletedEvents =
allEvents.filter {