mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-04 17:38:53 +01:00
fix: faster room joins
This commit is contained in:
parent
0823506d05
commit
75ba8bb565
3 changed files with 12 additions and 3 deletions
|
@ -49,11 +49,11 @@ impl Engine {
|
|||
fn prepare_conn(path: &Path, cache_size_kb: u32) -> Result<Connection> {
|
||||
let conn = Connection::open(&path)?;
|
||||
|
||||
conn.pragma_update(Some(Main), "page_size", &1024)?;
|
||||
conn.pragma_update(Some(Main), "page_size", &2048)?;
|
||||
conn.pragma_update(Some(Main), "journal_mode", &"WAL")?;
|
||||
conn.pragma_update(Some(Main), "synchronous", &"NORMAL")?;
|
||||
conn.pragma_update(Some(Main), "cache_size", &(-i64::from(cache_size_kb)))?;
|
||||
conn.pragma_update(Some(Main), "wal_autocheckpoint", &8000)?;
|
||||
conn.pragma_update(Some(Main), "wal_autocheckpoint", &2000)?;
|
||||
|
||||
Ok(conn)
|
||||
}
|
||||
|
|
|
@ -392,6 +392,7 @@ impl Rooms {
|
|||
&pdu.sender,
|
||||
None,
|
||||
db,
|
||||
false,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
@ -400,6 +401,8 @@ impl Rooms {
|
|||
}
|
||||
}
|
||||
|
||||
self.update_joined_count(room_id)?;
|
||||
|
||||
self.roomid_shortstatehash
|
||||
.insert(room_id.as_bytes(), &new_shortstatehash.to_be_bytes())?;
|
||||
|
||||
|
@ -1285,6 +1288,7 @@ impl Rooms {
|
|||
&pdu.sender,
|
||||
invite_state,
|
||||
db,
|
||||
true,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
@ -2051,6 +2055,7 @@ impl Rooms {
|
|||
sender: &UserId,
|
||||
last_state: Option<Vec<Raw<AnyStrippedStateEvent>>>,
|
||||
db: &Database,
|
||||
update_joined_count: bool,
|
||||
) -> Result<()> {
|
||||
// Keep track what remote users exist by adding them as "deactivated" users
|
||||
if user_id.server_name() != db.globals.server_name() {
|
||||
|
@ -2232,7 +2237,9 @@ impl Rooms {
|
|||
_ => {}
|
||||
}
|
||||
|
||||
self.update_joined_count(room_id)?;
|
||||
if update_joined_count {
|
||||
self.update_joined_count(room_id)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -2269,6 +2276,7 @@ impl Rooms {
|
|||
user_id,
|
||||
last_state,
|
||||
db,
|
||||
true,
|
||||
)?;
|
||||
} else {
|
||||
let mutex_state = Arc::clone(
|
||||
|
|
|
@ -2471,6 +2471,7 @@ pub async fn create_invite_route(
|
|||
&sender,
|
||||
Some(invite_state),
|
||||
&db,
|
||||
true,
|
||||
)?;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue