mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-12-05 06:41:46 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
554f270da3 | ||
|
|
881b6179e6 |
No files matched your search
@@ -69,7 +69,7 @@ jobs:
|
||||
CARGO_INCREMENTAL=${{ env.BUILDKIT_ENDPOINT != '' && '1' || '0' }}
|
||||
TARGET_CPU=
|
||||
RUST_PROFILE=release
|
||||
CARGO_FEATURES=default,http3
|
||||
CARGO_FEATURES=default
|
||||
platforms: ${{ matrix.platform }}
|
||||
labels: ${{ steps.prepare.outputs.metadata_labels }}
|
||||
annotations: ${{ steps.prepare.outputs.metadata_annotations }}
|
||||
@@ -154,7 +154,7 @@ jobs:
|
||||
CARGO_INCREMENTAL=${{ env.BUILDKIT_ENDPOINT != '' && '1' || '0' }}
|
||||
TARGET_CPU=${{ matrix.target_cpu }}
|
||||
RUST_PROFILE=release-max-perf
|
||||
CARGO_FEATURES=default,http3,release_max_log_level
|
||||
CARGO_FEATURES=default,release_max_log_level
|
||||
platforms: ${{ matrix.platform }}
|
||||
labels: ${{ steps.prepare.outputs.metadata_labels }}
|
||||
annotations: ${{ steps.prepare.outputs.metadata_annotations }}
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ assets = [
|
||||
default = [
|
||||
"standard",
|
||||
"jemalloc",
|
||||
"aws_lc_rs",
|
||||
"ring",
|
||||
"bindgen-runtime", # replace with bindgen-static on alpine
|
||||
]
|
||||
standard = [
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ pub fn run_with_args(args: &Args) -> Result<()> {
|
||||
#[cfg(feature = "aws_lc_rs")]
|
||||
rustls::crypto::aws_lc_rs::default_provider()
|
||||
.install_default()
|
||||
.expect("failed to initialise aws_lc_rs rustls crypto provider");
|
||||
.expect("failed to initialise ring rustls crypto provider");
|
||||
|
||||
#[cfg(all(feature = "ring", not(feature = "aws_lc_rs")))]
|
||||
rustls::crypto::ring::default_provider()
|
||||
|
||||
@@ -149,4 +149,4 @@ ignored = ["reqwest_0_12"]
|
||||
|
||||
[dev-dependencies]
|
||||
opentelemetry.workspace = true
|
||||
rustls = { workspace = true, features = ["aws_lc_rs"] }
|
||||
rustls = { workspace = true, features = ["ring"] }
|
||||
@@ -112,31 +112,44 @@ impl Service {
|
||||
query: &'a RoomQuery<'a>,
|
||||
sender_user: &'a UserId,
|
||||
) -> Result<(usize, impl Stream<Item = PduEvent> + Send + 'a)> {
|
||||
let pdu_ids: Vec<_> = self.search_pdu_ids(query).await?.collect().await;
|
||||
let (count, page) = if let Some(user_id) = query.user_id {
|
||||
let filter = &query.criteria.filter;
|
||||
self.search_pdu_ids(query)
|
||||
.await?
|
||||
.wide_filter_map(move |result_pdu_id: RawPduId| async move {
|
||||
self.services
|
||||
.timeline
|
||||
.get_pdu_from_id(&result_pdu_id)
|
||||
.await
|
||||
.ok()
|
||||
})
|
||||
.ready_filter(|pdu| !pdu.is_redacted())
|
||||
.ready_filter(move |pdu| filter.matches(pdu))
|
||||
.wide_filter_map(move |pdu| async move {
|
||||
self.services
|
||||
.state_accessor
|
||||
.user_can_see_event(user_id, &pdu.room_id_or_hash(), pdu.event_id())
|
||||
.await
|
||||
.then_some(pdu)
|
||||
})
|
||||
.ready_fold(
|
||||
(0_usize, Vec::with_capacity(query.limit)),
|
||||
|(mut count, mut page), pdu| {
|
||||
if count >= query.skip && page.len() < query.limit {
|
||||
page.push(pdu);
|
||||
}
|
||||
count = count.saturating_add(1);
|
||||
(count, page)
|
||||
},
|
||||
)
|
||||
.await
|
||||
} else {
|
||||
(0, Vec::new())
|
||||
};
|
||||
|
||||
let filter = &query.criteria.filter;
|
||||
let count = pdu_ids.len();
|
||||
let pdus = pdu_ids
|
||||
let pdus = page
|
||||
.into_iter()
|
||||
.stream()
|
||||
.wide_filter_map(move |result_pdu_id: RawPduId| async move {
|
||||
self.services
|
||||
.timeline
|
||||
.get_pdu_from_id(&result_pdu_id)
|
||||
.await
|
||||
.ok()
|
||||
})
|
||||
.ready_filter(|pdu| !pdu.is_redacted())
|
||||
.ready_filter(move |pdu| filter.matches(pdu))
|
||||
.wide_filter_map(move |pdu| async move {
|
||||
self.services
|
||||
.state_accessor
|
||||
.user_can_see_event(query.user_id?, pdu.room_id().unwrap(), pdu.event_id())
|
||||
.await
|
||||
.then_some(pdu)
|
||||
})
|
||||
.skip(query.skip)
|
||||
.take(query.limit)
|
||||
.wide_filter_map(async move |mut pdu| {
|
||||
let ctx = self
|
||||
.services
|
||||
|
||||
@@ -19,7 +19,7 @@ pub(crate) async fn test_services() -> TestServices { test_services_with(json!({
|
||||
|
||||
pub(crate) async fn test_services_with(overrides: serde_json::Value) -> TestServices {
|
||||
let guard = DATABASE.lock().await;
|
||||
let _ = rustls::crypto::aws_lc_rs::default_provider().install_default();
|
||||
let _ = rustls::crypto::ring::default_provider().install_default();
|
||||
let path = std::env::temp_dir()
|
||||
.join(format!("continuwuity-shared-state-{:016x}", rand::random::<u64>()));
|
||||
std::fs::create_dir(&path).unwrap();
|
||||
|
||||
Reference in new issue
Block a user