Tuning limits for Global feeds
This commit is contained in:
+3
-3
@@ -95,7 +95,7 @@ fun filterSummaryNotificationsToPubkey(
|
||||
Filter(
|
||||
kinds = SummaryKinds,
|
||||
tags = mapOf("p" to listOf(pubkey)),
|
||||
limit = if (since == null) 2000 else null,
|
||||
limit = 2000,
|
||||
since = since,
|
||||
),
|
||||
),
|
||||
@@ -116,7 +116,7 @@ fun filterNotificationsToPubkey(
|
||||
Filter(
|
||||
kinds = NotificationsPerKeyKinds,
|
||||
tags = mapOf("p" to listOf(pubkey)),
|
||||
limit = if (since == null) 50 else null,
|
||||
limit = 50,
|
||||
since = since,
|
||||
),
|
||||
),
|
||||
@@ -126,7 +126,7 @@ fun filterNotificationsToPubkey(
|
||||
Filter(
|
||||
kinds = NotificationsPerKeyKinds2,
|
||||
tags = mapOf("p" to listOf(pubkey)),
|
||||
limit = if (since == null) 100 else null,
|
||||
limit = 100,
|
||||
since = since,
|
||||
),
|
||||
),
|
||||
|
||||
+3
-3
@@ -38,9 +38,9 @@ class DiscoveryFilterAssembler(
|
||||
) : ComposeSubscriptionManager<DiscoveryQueryState>() {
|
||||
val group =
|
||||
listOf(
|
||||
DiscoveryFollowsDiscoverySubAssembler1(client, ::allKeys),
|
||||
DiscoveryFollowsDiscoverySubAssembler2(client, ::allKeys),
|
||||
DiscoveryFollowsDiscoverySubAssembler3(client, ::allKeys),
|
||||
DiscoveryLongFormClassifiedsAndDVMSubAssembler1(client, ::allKeys),
|
||||
DiscoveryFollowsSetsAndLiveStreamsSubAssembler2(client, ::allKeys),
|
||||
DiscoveryPublicChatsAndCommunitiesSubAssembler3(client, ::allKeys),
|
||||
)
|
||||
|
||||
override fun invalidateKeys() = invalidateFilters()
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.sample
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class DiscoveryFollowsDiscoverySubAssembler2(
|
||||
class DiscoveryFollowsSetsAndLiveStreamsSubAssembler2(
|
||||
client: NostrClient,
|
||||
allKeys: () -> Set<DiscoveryQueryState>,
|
||||
) : PerUserAndFollowListEoseManager<DiscoveryQueryState, String>(client, allKeys) {
|
||||
+1
-1
@@ -37,7 +37,7 @@ import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.sample
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class DiscoveryFollowsDiscoverySubAssembler1(
|
||||
class DiscoveryLongFormClassifiedsAndDVMSubAssembler1(
|
||||
client: NostrClient,
|
||||
allKeys: () -> Set<DiscoveryQueryState>,
|
||||
) : PerUserAndFollowListEoseManager<DiscoveryQueryState, String>(client, allKeys) {
|
||||
+1
-1
@@ -36,7 +36,7 @@ import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.sample
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class DiscoveryFollowsDiscoverySubAssembler3(
|
||||
class DiscoveryPublicChatsAndCommunitiesSubAssembler3(
|
||||
client: NostrClient,
|
||||
allKeys: () -> Set<DiscoveryQueryState>,
|
||||
) : PerUserAndFollowListEoseManager<DiscoveryQueryState, String>(client, allKeys) {
|
||||
+2
-1
@@ -25,6 +25,7 @@ import com.vitorpamplona.amethyst.service.relays.SincePerRelayMap
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter
|
||||
import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
fun filterLongFormGlobal(
|
||||
relays: GlobalTopNavPerRelayFilterSet,
|
||||
@@ -34,7 +35,7 @@ fun filterLongFormGlobal(
|
||||
if (relays.set.isEmpty()) return emptyList()
|
||||
|
||||
return relays.set.map {
|
||||
val since = since?.get(it.key)?.time ?: defaultSince
|
||||
val since = since?.get(it.key)?.time ?: defaultSince ?: TimeUtils.oneWeekAgo()
|
||||
RelayBasedFilter(
|
||||
relay = it.key,
|
||||
filter =
|
||||
|
||||
+28
-14
@@ -27,6 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter
|
||||
import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent
|
||||
import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMetadataEvent
|
||||
import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
fun filterPublicChatsGlobal(
|
||||
relays: GlobalTopNavPerRelayFilterSet,
|
||||
@@ -35,21 +36,34 @@ fun filterPublicChatsGlobal(
|
||||
): List<RelayBasedFilter> {
|
||||
if (relays.set.isEmpty()) return emptyList()
|
||||
|
||||
return relays.set.map {
|
||||
return relays.set.flatMap {
|
||||
val since = since?.get(it.key)?.time ?: defaultSince
|
||||
RelayBasedFilter(
|
||||
relay = it.key,
|
||||
filter =
|
||||
Filter(
|
||||
kinds =
|
||||
listOf(
|
||||
ChannelCreateEvent.KIND,
|
||||
ChannelMetadataEvent.KIND,
|
||||
ChannelMessageEvent.KIND,
|
||||
),
|
||||
limit = 30,
|
||||
since = since,
|
||||
),
|
||||
listOf(
|
||||
RelayBasedFilter(
|
||||
relay = it.key,
|
||||
filter =
|
||||
Filter(
|
||||
kinds =
|
||||
listOf(
|
||||
ChannelCreateEvent.KIND,
|
||||
ChannelMetadataEvent.KIND,
|
||||
),
|
||||
limit = 30,
|
||||
since = since,
|
||||
),
|
||||
),
|
||||
RelayBasedFilter(
|
||||
relay = it.key,
|
||||
filter =
|
||||
Filter(
|
||||
kinds =
|
||||
listOf(
|
||||
ChannelMessageEvent.KIND,
|
||||
),
|
||||
limit = 50,
|
||||
since = since ?: TimeUtils.oneWeekAgo(),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ fun filterFollowSetsGlobal(
|
||||
filter =
|
||||
Filter(
|
||||
kinds = listOf(FollowListEvent.KIND),
|
||||
limit = 300,
|
||||
limit = 100,
|
||||
since = since,
|
||||
),
|
||||
)
|
||||
|
||||
+24
-11
@@ -26,6 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter
|
||||
import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent
|
||||
import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
fun filterLiveActivitiesGlobal(
|
||||
relays: GlobalTopNavPerRelayFilterSet,
|
||||
@@ -34,16 +35,28 @@ fun filterLiveActivitiesGlobal(
|
||||
): List<RelayBasedFilter> {
|
||||
if (relays.set.isEmpty()) return emptyList()
|
||||
|
||||
return relays.set.map {
|
||||
val since = since?.get(it.key)?.time ?: defaultSince
|
||||
RelayBasedFilter(
|
||||
relay = it.key,
|
||||
filter =
|
||||
Filter(
|
||||
kinds = listOf(LiveActivitiesChatMessageEvent.KIND, LiveActivitiesEvent.KIND),
|
||||
limit = 30,
|
||||
since = since,
|
||||
return relays.set
|
||||
.map {
|
||||
val since = since?.get(it.key)?.time ?: defaultSince
|
||||
listOf(
|
||||
RelayBasedFilter(
|
||||
relay = it.key,
|
||||
filter =
|
||||
Filter(
|
||||
kinds = listOf(LiveActivitiesEvent.KIND),
|
||||
limit = 30,
|
||||
since = since ?: TimeUtils.oneWeekAgo(),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
RelayBasedFilter(
|
||||
relay = it.key,
|
||||
filter =
|
||||
Filter(
|
||||
kinds = listOf(LiveActivitiesChatMessageEvent.KIND),
|
||||
limit = 50,
|
||||
since = since ?: TimeUtils.oneDayAgo(),
|
||||
),
|
||||
),
|
||||
)
|
||||
}.flatten()
|
||||
}
|
||||
|
||||
+3
-2
@@ -26,6 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter
|
||||
import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent
|
||||
import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
fun filterCommunitiesGlobal(
|
||||
relays: GlobalTopNavPerRelayFilterSet,
|
||||
@@ -51,8 +52,8 @@ fun filterCommunitiesGlobal(
|
||||
filter =
|
||||
Filter(
|
||||
kinds = listOf(CommunityPostApprovalEvent.KIND),
|
||||
limit = 30,
|
||||
since = since,
|
||||
limit = 100,
|
||||
since = since ?: TimeUtils.oneWeekAgo(),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ fun filterClassifiedsAuthors(
|
||||
Filter(
|
||||
authors = authorList,
|
||||
kinds = listOf(ClassifiedsEvent.KIND),
|
||||
limit = 300,
|
||||
limit = authorList.size * 10,
|
||||
since = since,
|
||||
),
|
||||
),
|
||||
|
||||
+2
-1
@@ -25,6 +25,7 @@ import com.vitorpamplona.amethyst.service.relays.SincePerRelayMap
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter
|
||||
import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
fun filterClassifiedsGlobal(
|
||||
relays: GlobalTopNavPerRelayFilterSet,
|
||||
@@ -34,7 +35,7 @@ fun filterClassifiedsGlobal(
|
||||
if (relays.set.isEmpty()) return emptyList()
|
||||
|
||||
return relays.set.flatMap {
|
||||
val since = since?.get(it.key)?.time ?: defaultSince
|
||||
val since = since?.get(it.key)?.time ?: defaultSince ?: TimeUtils.oneMonthAgo()
|
||||
listOf(
|
||||
RelayBasedFilter(
|
||||
relay = it.key,
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ fun filterPictureAndVideoGeohash(
|
||||
Filter(
|
||||
kinds = PictureAndVideoKinds,
|
||||
tags = mapOf("g" to geoHashes),
|
||||
limit = if (since == null) 200 else null,
|
||||
limit = 200,
|
||||
since = since,
|
||||
),
|
||||
),
|
||||
@@ -57,7 +57,7 @@ fun filterPictureAndVideoGeohash(
|
||||
"g" to geoHashes,
|
||||
"m" to LegacyMimeTypes,
|
||||
),
|
||||
limit = if (since == null) 200 else null,
|
||||
limit = 200,
|
||||
since = since,
|
||||
),
|
||||
),
|
||||
|
||||
+2
-2
@@ -44,7 +44,7 @@ fun filterPictureAndVideoHashtag(
|
||||
Filter(
|
||||
kinds = PictureAndVideoKinds,
|
||||
tags = mapOf("t" to hashtags),
|
||||
limit = if (since == null) 100 else null,
|
||||
limit = 100,
|
||||
since = since,
|
||||
),
|
||||
),
|
||||
@@ -58,7 +58,7 @@ fun filterPictureAndVideoHashtag(
|
||||
"t" to hashtags,
|
||||
"m" to LegacyMimeTypes,
|
||||
),
|
||||
limit = if (since == null) 100 else null,
|
||||
limit = 100,
|
||||
since = since,
|
||||
),
|
||||
),
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ fun filterPictureAndVideoGlobal(
|
||||
filter =
|
||||
Filter(
|
||||
kinds = PictureAndVideoKinds,
|
||||
limit = if (since == null) 50 else null,
|
||||
limit = 50,
|
||||
since = since,
|
||||
),
|
||||
),
|
||||
@@ -53,7 +53,7 @@ fun filterPictureAndVideoGlobal(
|
||||
Filter(
|
||||
kinds = PictureAndVideoLegacyKinds,
|
||||
tags = LegacyMimeTypeMap,
|
||||
limit = if (since == null) 50 else null,
|
||||
limit = 50,
|
||||
since = since,
|
||||
),
|
||||
),
|
||||
|
||||
+4
-4
@@ -52,7 +52,7 @@ fun filterPictureAndVideoAllCommunities(
|
||||
"a" to communityList,
|
||||
"k" to PictureAndVideoKTags,
|
||||
),
|
||||
limit = if (since == null) 200 else null,
|
||||
limit = 200,
|
||||
since = since,
|
||||
),
|
||||
),
|
||||
@@ -63,7 +63,7 @@ fun filterPictureAndVideoAllCommunities(
|
||||
Filter(
|
||||
tags = mapOf("a" to communityList),
|
||||
kinds = PictureAndVideoKinds,
|
||||
limit = if (since == null) 200 else null,
|
||||
limit = 200,
|
||||
since = since,
|
||||
),
|
||||
),
|
||||
@@ -78,7 +78,7 @@ fun filterPictureAndVideoAllCommunities(
|
||||
"a" to communityList,
|
||||
"k" to listOf(FileHeaderEvent.KIND.toString(), FileStorageHeaderEvent.KIND.toString()),
|
||||
),
|
||||
limit = if (since == null) 200 else null,
|
||||
limit = 200,
|
||||
since = since,
|
||||
),
|
||||
),
|
||||
@@ -93,7 +93,7 @@ fun filterPictureAndVideoAllCommunities(
|
||||
"m" to LegacyMimeTypes,
|
||||
),
|
||||
kinds = PictureAndVideoLegacyKinds,
|
||||
limit = if (since == null) 200 else null,
|
||||
limit = 200,
|
||||
since = since,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user