mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
refactor(perf): Push down visibility check after limit
This commit is contained in:
@@ -152,8 +152,8 @@ async fn paginate_relations_with_filter(
|
|||||||
})
|
})
|
||||||
.stream()
|
.stream()
|
||||||
.ready_take_while(|(count, _)| Some(*count) != to)
|
.ready_take_while(|(count, _)| Some(*count) != to)
|
||||||
.wide_filter_map(|item| visibility_filter(services, sender_user, item))
|
|
||||||
.take(limit)
|
.take(limit)
|
||||||
|
.wide_filter_map(|item| visibility_filter(services, sender_user, item))
|
||||||
.then(async |mut pdu| {
|
.then(async |mut pdu| {
|
||||||
if let Err(e) = services
|
if let Err(e) = services
|
||||||
.rooms
|
.rooms
|
||||||
@@ -223,10 +223,6 @@ async fn paginate_relations_with_filter(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Can we move the visibility filter lower down, to avoid checking events
|
|
||||||
// that won't be sent? At the moment this also results in getting events that
|
|
||||||
// appear to have no relation because intermediaries are not visible to the
|
|
||||||
// user.
|
|
||||||
async fn visibility_filter<Pdu: Event + Send + Sync>(
|
async fn visibility_filter<Pdu: Event + Send + Sync>(
|
||||||
services: &Services,
|
services: &Services,
|
||||||
sender_user: &UserId,
|
sender_user: &UserId,
|
||||||
|
|||||||
Reference in New Issue
Block a user