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> {
|
fn prepare_conn(path: &Path, cache_size_kb: u32) -> Result<Connection> {
|
||||||
let conn = Connection::open(&path)?;
|
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), "journal_mode", &"WAL")?;
|
||||||
conn.pragma_update(Some(Main), "synchronous", &"NORMAL")?;
|
conn.pragma_update(Some(Main), "synchronous", &"NORMAL")?;
|
||||||
conn.pragma_update(Some(Main), "cache_size", &(-i64::from(cache_size_kb)))?;
|
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)
|
Ok(conn)
|
||||||
}
|
}
|
||||||
|
|
|
@ -392,6 +392,7 @@ impl Rooms {
|
||||||
&pdu.sender,
|
&pdu.sender,
|
||||||
None,
|
None,
|
||||||
db,
|
db,
|
||||||
|
false,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -400,6 +401,8 @@ impl Rooms {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.update_joined_count(room_id)?;
|
||||||
|
|
||||||
self.roomid_shortstatehash
|
self.roomid_shortstatehash
|
||||||
.insert(room_id.as_bytes(), &new_shortstatehash.to_be_bytes())?;
|
.insert(room_id.as_bytes(), &new_shortstatehash.to_be_bytes())?;
|
||||||
|
|
||||||
|
@ -1285,6 +1288,7 @@ impl Rooms {
|
||||||
&pdu.sender,
|
&pdu.sender,
|
||||||
invite_state,
|
invite_state,
|
||||||
db,
|
db,
|
||||||
|
true,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2051,6 +2055,7 @@ impl Rooms {
|
||||||
sender: &UserId,
|
sender: &UserId,
|
||||||
last_state: Option<Vec<Raw<AnyStrippedStateEvent>>>,
|
last_state: Option<Vec<Raw<AnyStrippedStateEvent>>>,
|
||||||
db: &Database,
|
db: &Database,
|
||||||
|
update_joined_count: bool,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
// Keep track what remote users exist by adding them as "deactivated" users
|
// Keep track what remote users exist by adding them as "deactivated" users
|
||||||
if user_id.server_name() != db.globals.server_name() {
|
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)?;
|
self.update_joined_count(room_id)?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -2269,6 +2276,7 @@ impl Rooms {
|
||||||
user_id,
|
user_id,
|
||||||
last_state,
|
last_state,
|
||||||
db,
|
db,
|
||||||
|
true,
|
||||||
)?;
|
)?;
|
||||||
} else {
|
} else {
|
||||||
let mutex_state = Arc::clone(
|
let mutex_state = Arc::clone(
|
||||||
|
|
|
@ -2471,6 +2471,7 @@ pub async fn create_invite_route(
|
||||||
&sender,
|
&sender,
|
||||||
Some(invite_state),
|
Some(invite_state),
|
||||||
&db,
|
&db,
|
||||||
|
true,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue