remove dead cache

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-07-03 23:11:05 +00:00
parent f104ced55d
commit 25c004f08c
2 changed files with 6 additions and 15 deletions

View file

@ -1,7 +1,7 @@
mod data; mod data;
use std::{ use std::{
collections::{BTreeMap, HashMap, HashSet}, collections::{BTreeMap, HashSet},
sync::Arc, sync::Arc,
}; };
@ -27,12 +27,12 @@ use ruma::{
push::{Action, Ruleset, Tweak}, push::{Action, Ruleset, Tweak},
serde::Base64, serde::Base64,
state_res::{self, Event, RoomVersion}, state_res::{self, Event, RoomVersion},
uint, user_id, CanonicalJsonObject, CanonicalJsonValue, EventId, OwnedEventId, OwnedRoomId, OwnedServerName, uint, user_id, CanonicalJsonObject, CanonicalJsonValue, EventId, OwnedEventId, OwnedServerName, RoomId,
RoomId, RoomVersionId, ServerName, UserId, RoomVersionId, ServerName, UserId,
}; };
use serde::Deserialize; use serde::Deserialize;
use serde_json::value::{to_raw_value, RawValue as RawJsonValue}; use serde_json::value::{to_raw_value, RawValue as RawJsonValue};
use tokio::sync::{Mutex, RwLock}; use tokio::sync::RwLock;
use crate::{ use crate::{
admin, admin,
@ -66,15 +66,12 @@ struct ExtractBody {
pub struct Service { pub struct Service {
db: Data, db: Data,
pub lasttimelinecount_cache: Mutex<HashMap<OwnedRoomId, PduCount>>,
} }
impl Service { impl Service {
pub fn build(_server: &Arc<Server>, db: &Arc<Database>) -> Result<Self> { pub fn build(_server: &Arc<Server>, db: &Arc<Database>) -> Result<Self> {
Ok(Self { Ok(Self {
db: Data::new(db), db: Data::new(db),
lasttimelinecount_cache: Mutex::new(HashMap::new()),
}) })
} }

View file

@ -95,10 +95,7 @@ impl Services {
let lasttimelinecount_cache = self let lasttimelinecount_cache = self
.rooms .rooms
.timeline .timeline
.lasttimelinecount_cache .get_lasttimelinecount_cache_usage().0;
.lock()
.await
.len();
let roomid_spacehierarchy_cache = self let roomid_spacehierarchy_cache = self
.rooms .rooms
.spaces .spaces
@ -177,10 +174,7 @@ bad_signature_ratelimiter: {bad_signature_ratelimiter}
if amount > 4 { if amount > 4 {
self.rooms self.rooms
.timeline .timeline
.lasttimelinecount_cache .clear_lasttimelinecount_cache();
.lock()
.await
.clear();
} }
if amount > 5 { if amount > 5 {
self.rooms self.rooms