improvement: flush after every request that manipulates the db
This commit is contained in:
parent
b2a1505535
commit
6dbe195695
30 changed files with 216 additions and 105 deletions
|
@ -18,7 +18,7 @@ use rocket::{delete, get, put};
|
|||
feature = "conduit_bin",
|
||||
put("/_matrix/client/r0/directory/room/<_>", data = "<body>")
|
||||
)]
|
||||
pub fn create_alias_route(
|
||||
pub async fn create_alias_route(
|
||||
db: State<'_, Database>,
|
||||
body: Ruma<create_alias::Request<'_>>,
|
||||
) -> ConduitResult<create_alias::Response> {
|
||||
|
@ -29,6 +29,8 @@ pub fn create_alias_route(
|
|||
db.rooms
|
||||
.set_alias(&body.room_alias, Some(&body.room_id), &db.globals)?;
|
||||
|
||||
db.flush().await?;
|
||||
|
||||
Ok(create_alias::Response::new().into())
|
||||
}
|
||||
|
||||
|
@ -36,12 +38,14 @@ pub fn create_alias_route(
|
|||
feature = "conduit_bin",
|
||||
delete("/_matrix/client/r0/directory/room/<_>", data = "<body>")
|
||||
)]
|
||||
pub fn delete_alias_route(
|
||||
pub async fn delete_alias_route(
|
||||
db: State<'_, Database>,
|
||||
body: Ruma<delete_alias::Request<'_>>,
|
||||
) -> ConduitResult<delete_alias::Response> {
|
||||
db.rooms.set_alias(&body.room_alias, None, &db.globals)?;
|
||||
|
||||
db.flush().await?;
|
||||
|
||||
Ok(delete_alias::Response::new().into())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue