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