π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Load Space feed and share keys concurrently
Anand Baburajanb19d2b9d0779
diff --git a/rust/Cargo.lock b/rust/Cargo.lockindex 9ae6aca003..6646d1bd0a 100644--- a/rust/Cargo.lock+++ b/rust/Cargo.lock@@ -2522,6 +2522,7 @@ dependencies = ["ente-accounts","ente-core","ente-test-support",+ "futures-util","md-5 0.11.0","mockito","reqwest 0.12.28",diff --git a/rust/space/Cargo.toml b/rust/space/Cargo.tomlindex 5c8cde81f9..199d1dc05f 100644--- a/rust/space/Cargo.toml+++ b/rust/space/Cargo.toml@@ -8,6 +8,7 @@ museum = ["ente-core/srp"][dependencies]ente-core.workspace = true+futures-util = "0.3.32"md-5 = "0.11"serde.workspace = trueserde_json.workspace = truediff --git a/rust/space/src/client/posts.rs b/rust/space/src/client/posts.rsindex f3bf7284de..1e206d2710 100644--- a/rust/space/src/client/posts.rs+++ b/rust/space/src/client/posts.rs@@ -111,15 +111,22 @@ impl AccountSpaceCtx {query.push(("limit", value.to_string()));}let path = format!("/spaces/{space_id}/feed");- Ok(self- .api()- .get(&path)- .query(&query)- .send()- .await?- .error_for_status()?- .json()- .await?)+ let fetch_feed = async {+ Ok(self+ .api()+ .get(&path)+ .query(&query)+ .send()+ .await?+ .error_for_status()?+ .json()+ .await?)+ };+ let (page, _) = futures_util::try_join!(+ fetch_feed,+ self.list_decrypted_friend_shares_cached(space_id)+ )?;+ Ok(page)}pub async fn unread_status(&self, space_id: &str) -> Result<SpaceUnreadStatusResponse> {diff --git a/rust/space/src/client/tests.rs b/rust/space/src/client/tests.rsindex e91fdb41c5..af96a9b311 100644--- a/rust/space/src/client/tests.rs+++ b/rust/space/src/client/tests.rs@@ -1558,6 +1558,13 @@ async fn refresh_friend_shares_accepts_empty_server_response() {async fn list_feed_uses_space_feed_endpoint() {let mut server = Server::new_async().await;let ctx = test_account_ctx(&server.url());+ let shares = server+ .mock("GET", "/spaces/space_owner_main/friends/shares")+ .match_header("x-space-session-token", "space-session-token")+ .with_status(200)+ .with_body("[]")+ .create_async()+ .await;let feed = server.mock("GET", "/spaces/space_owner_main/feed").match_header("x-space-session-token", "space-session-token")@@ -1598,6 +1605,7 @@ async fn list_feed_uses_space_feed_endpoint() {assert_eq!(page.items.len(), 1);assert_eq!(page.items[0].post_id, 42);assert_eq!(page.next_cursor, "cursor-2");+ shares.assert_async().await;feed.assert_async().await;}