improvement: batched inserts for tokenids
This commit is contained in:
parent
fce22362d4
commit
9bb4c3cd01
3 changed files with 24 additions and 13 deletions
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
client_server::{self, claim_keys_helper, get_keys_helper},
|
||||
database::DatabaseGuard,
|
||||
database::{abstraction::sqlite::MILLI, DatabaseGuard},
|
||||
utils, ConduitResult, Database, Error, PduEvent, Result, Ruma,
|
||||
};
|
||||
use get_profile_information::v1::ProfileField;
|
||||
|
@ -1732,7 +1732,12 @@ fn get_auth_chain(starting_events: Vec<EventId>, db: &Database) -> Result<HashSe
|
|||
cached.clone()
|
||||
} else {
|
||||
drop(cache);
|
||||
let start = Instant::now();
|
||||
let auth_chain = get_auth_chain_recursive(&event_id, HashSet::new(), db)?;
|
||||
let elapsed = start.elapsed();
|
||||
if elapsed > MILLI {
|
||||
println!("auth chain for {} took {:?}", &event_id, elapsed)
|
||||
}
|
||||
|
||||
cache = db.rooms.auth_chain_cache();
|
||||
|
||||
|
@ -1747,7 +1752,11 @@ fn get_auth_chain(starting_events: Vec<EventId>, db: &Database) -> Result<HashSe
|
|||
Ok(full_auth_chain)
|
||||
}
|
||||
|
||||
fn get_auth_chain_recursive(event_id: &EventId, mut found: HashSet<EventId>, db: &Database) -> Result<HashSet<EventId>> {
|
||||
fn get_auth_chain_recursive(
|
||||
event_id: &EventId,
|
||||
mut found: HashSet<EventId>,
|
||||
db: &Database,
|
||||
) -> Result<HashSet<EventId>> {
|
||||
if let Some(pdu) = db.rooms.get_pdu(&event_id)? {
|
||||
for auth_event in &pdu.auth_events {
|
||||
if !found.contains(auth_event) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue