|
|
|
@ -1760,14 +1760,14 @@ fn get_auth_chain(starting_events: Vec<EventId>, db: &Database) -> Result<HashSe |
|
|
|
let mut cache = db.rooms.auth_chain_cache(); |
|
|
|
let mut cache = db.rooms.auth_chain_cache(); |
|
|
|
|
|
|
|
|
|
|
|
for event_id in &starting_events { |
|
|
|
for event_id in &starting_events { |
|
|
|
if let Some(cached) = cache.get_mut(&[event_id.clone()][..]) { |
|
|
|
if let Some(cached) = cache.get_mut(event_id) { |
|
|
|
full_auth_chain.extend(cached.iter().cloned()); |
|
|
|
full_auth_chain.extend(cached.iter().cloned()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
drop(cache); |
|
|
|
drop(cache); |
|
|
|
let mut auth_chain = HashSet::new(); |
|
|
|
let mut auth_chain = HashSet::new(); |
|
|
|
get_auth_chain_recursive(&event_id, &mut auth_chain, db)?; |
|
|
|
get_auth_chain_recursive(&event_id, &mut auth_chain, db)?; |
|
|
|
cache = db.rooms.auth_chain_cache(); |
|
|
|
cache = db.rooms.auth_chain_cache(); |
|
|
|
cache.insert(vec![event_id.clone()], auth_chain.clone()); |
|
|
|
cache.insert(event_id.clone(), auth_chain.clone()); |
|
|
|
full_auth_chain.extend(auth_chain); |
|
|
|
full_auth_chain.extend(auth_chain); |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|