cleanup on drop for utils::mutex_map.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
01b2928d55
commit
2d251eb19c
10 changed files with 131 additions and 54 deletions
|
@ -12,7 +12,11 @@ use std::{
|
|||
time::Instant,
|
||||
};
|
||||
|
||||
use conduit::{error, trace, utils::MutexMap, Config, Result};
|
||||
use conduit::{
|
||||
error, trace,
|
||||
utils::{MutexMap, MutexMapGuard},
|
||||
Config, Result,
|
||||
};
|
||||
use data::Data;
|
||||
use ipaddress::IPAddress;
|
||||
use regex::RegexSet;
|
||||
|
@ -27,8 +31,6 @@ use url::Url;
|
|||
|
||||
use crate::services;
|
||||
|
||||
type RateLimitState = (Instant, u32); // Time if last failed try, number of failed tries
|
||||
|
||||
pub struct Service {
|
||||
pub db: Data,
|
||||
|
||||
|
@ -43,9 +45,9 @@ pub struct Service {
|
|||
pub bad_event_ratelimiter: Arc<RwLock<HashMap<OwnedEventId, RateLimitState>>>,
|
||||
pub bad_signature_ratelimiter: Arc<RwLock<HashMap<Vec<String>, RateLimitState>>>,
|
||||
pub bad_query_ratelimiter: Arc<RwLock<HashMap<OwnedServerName, RateLimitState>>>,
|
||||
pub roomid_mutex_insert: MutexMap<OwnedRoomId, ()>,
|
||||
pub roomid_mutex_state: MutexMap<OwnedRoomId, ()>,
|
||||
pub roomid_mutex_federation: MutexMap<OwnedRoomId, ()>,
|
||||
pub roomid_mutex_insert: RoomMutexMap,
|
||||
pub roomid_mutex_state: RoomMutexMap,
|
||||
pub roomid_mutex_federation: RoomMutexMap,
|
||||
pub roomid_federationhandletime: RwLock<HashMap<OwnedRoomId, (OwnedEventId, Instant)>>,
|
||||
pub updates_handle: Mutex<Option<JoinHandle<()>>>,
|
||||
pub stateres_mutex: Arc<Mutex<()>>,
|
||||
|
@ -53,6 +55,10 @@ pub struct Service {
|
|||
pub admin_alias: OwnedRoomAliasId,
|
||||
}
|
||||
|
||||
pub type RoomMutexMap = MutexMap<OwnedRoomId, ()>;
|
||||
pub type RoomMutexGuard = MutexMapGuard<OwnedRoomId, ()>;
|
||||
type RateLimitState = (Instant, u32); // Time if last failed try, number of failed tries
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
let config = &args.server.config;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue