mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 16:21:24 +01:00
move shorteventid_cache to service
This commit is contained in:
parent
7563360bee
commit
47502d1f36
4 changed files with 45 additions and 30 deletions
|
|
@ -162,15 +162,6 @@ impl service::rooms::short::Data for KeyValueDatabase {
|
|||
&self,
|
||||
shorteventid: ShortEventId,
|
||||
) -> Result<Arc<EventId>> {
|
||||
let lookup = Lookup::ShortToEventId;
|
||||
|
||||
if let Some(id) =
|
||||
self.shorteventid_cache.lock().unwrap().get_mut(&shorteventid)
|
||||
{
|
||||
METRICS.record_lookup(lookup, FoundIn::Cache);
|
||||
return Ok(Arc::clone(id));
|
||||
}
|
||||
|
||||
let bytes = self
|
||||
.shorteventid_eventid
|
||||
.get(&shorteventid.get().to_be_bytes())?
|
||||
|
|
@ -189,13 +180,6 @@ impl service::rooms::short::Data for KeyValueDatabase {
|
|||
Error::bad_database("EventId in shorteventid_eventid is invalid.")
|
||||
})?;
|
||||
|
||||
METRICS.record_lookup(lookup, FoundIn::Database);
|
||||
|
||||
self.shorteventid_cache
|
||||
.lock()
|
||||
.unwrap()
|
||||
.insert(shorteventid, Arc::clone(&event_id));
|
||||
|
||||
Ok(event_id)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue