fix: faster room joins

next
Timo Kösters 2021-08-17 00:22:52 +02:00
parent 0823506d05
commit 75ba8bb565
No known key found for this signature in database
GPG Key ID: 24DA7517711A2BA4
3 changed files with 12 additions and 3 deletions

View File

@ -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)
}

View File

@ -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 {
_ => {}
}
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(

View File

@ -2471,6 +2471,7 @@ pub async fn create_invite_route(
&sender,
Some(invite_state),
&db,
true,
)?;
}