mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-06-27 02:16:36 +02:00
fetch shortstatehash and compressed info concurrently
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
5edc79ec47
commit
da65a8f545
1 changed files with 6 additions and 11 deletions
|
@ -17,7 +17,7 @@ use conduwuit::{
|
||||||
Err, Error, PduEvent, Result,
|
Err, Error, PduEvent, Result,
|
||||||
};
|
};
|
||||||
use database::{Deserialized, Map};
|
use database::{Deserialized, Map};
|
||||||
use futures::{FutureExt, StreamExt, TryFutureExt};
|
use futures::{future::try_join, FutureExt, StreamExt, TryFutureExt};
|
||||||
use lru_cache::LruCache;
|
use lru_cache::LruCache;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
events::{
|
events::{
|
||||||
|
@ -235,21 +235,16 @@ impl Service {
|
||||||
Id: for<'de> Deserialize<'de> + Sized + ToOwned,
|
Id: for<'de> Deserialize<'de> + Sized + ToOwned,
|
||||||
<Id as ToOwned>::Owned: Borrow<EventId>,
|
<Id as ToOwned>::Owned: Borrow<EventId>,
|
||||||
{
|
{
|
||||||
let shortstatekey = self
|
let shortstatekey = self.services.short.get_shortstatekey(event_type, state_key);
|
||||||
.services
|
|
||||||
.short
|
|
||||||
.get_shortstatekey(event_type, state_key)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
let full_state = self
|
let full_state = self
|
||||||
.services
|
.services
|
||||||
.state_compressor
|
.state_compressor
|
||||||
.load_shortstatehash_info(shortstatehash)
|
.load_shortstatehash_info(shortstatehash)
|
||||||
.await
|
.map_ok(|mut vec| vec.pop().expect("there is always one layer").full_state)
|
||||||
.map_err(|e| err!(Database(error!(?event_type, ?state_key, "Missing state: {e:?}"))))?
|
.map_err(|e| err!(Database(error!(?event_type, ?state_key, "Missing state: {e:?}"))));
|
||||||
.pop()
|
|
||||||
.expect("there is always one layer")
|
let (shortstatekey, full_state) = try_join(shortstatekey, full_state).await?;
|
||||||
.full_state;
|
|
||||||
|
|
||||||
let compressed = full_state
|
let compressed = full_state
|
||||||
.iter()
|
.iter()
|
||||||
|
|
Loading…
Add table
Reference in a new issue