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
|
@ -22,7 +22,7 @@ use rocket::{get, post};
|
|||
feature = "conduit_bin",
|
||||
post("/_matrix/client/r0/keys/upload", data = "<body>")
|
||||
)]
|
||||
pub fn upload_keys_route(
|
||||
pub async fn upload_keys_route(
|
||||
db: State<'_, Database>,
|
||||
body: Ruma<upload_keys::Request<'_>>,
|
||||
) -> ConduitResult<upload_keys::Response> {
|
||||
|
@ -58,6 +58,8 @@ pub fn upload_keys_route(
|
|||
}
|
||||
}
|
||||
|
||||
db.flush().await?;
|
||||
|
||||
Ok(upload_keys::Response {
|
||||
one_time_key_counts: db.users.count_one_time_keys(sender_user, sender_device)?,
|
||||
}
|
||||
|
@ -68,7 +70,7 @@ pub fn upload_keys_route(
|
|||
feature = "conduit_bin",
|
||||
post("/_matrix/client/r0/keys/query", data = "<body>")
|
||||
)]
|
||||
pub fn get_keys_route(
|
||||
pub async fn get_keys_route(
|
||||
db: State<'_, Database>,
|
||||
body: Ruma<get_keys::Request<'_>>,
|
||||
) -> ConduitResult<get_keys::Response> {
|
||||
|
@ -148,7 +150,7 @@ pub fn get_keys_route(
|
|||
feature = "conduit_bin",
|
||||
post("/_matrix/client/r0/keys/claim", data = "<body>")
|
||||
)]
|
||||
pub fn claim_keys_route(
|
||||
pub async fn claim_keys_route(
|
||||
db: State<'_, Database>,
|
||||
body: Ruma<claim_keys::Request>,
|
||||
) -> ConduitResult<claim_keys::Response> {
|
||||
|
@ -168,6 +170,8 @@ pub fn claim_keys_route(
|
|||
one_time_keys.insert(user_id.clone(), container);
|
||||
}
|
||||
|
||||
db.flush().await?;
|
||||
|
||||
Ok(claim_keys::Response {
|
||||
failures: BTreeMap::new(),
|
||||
one_time_keys,
|
||||
|
@ -179,7 +183,7 @@ pub fn claim_keys_route(
|
|||
feature = "conduit_bin",
|
||||
post("/_matrix/client/unstable/keys/device_signing/upload", data = "<body>")
|
||||
)]
|
||||
pub fn upload_signing_keys_route(
|
||||
pub async fn upload_signing_keys_route(
|
||||
db: State<'_, Database>,
|
||||
body: Ruma<upload_signing_keys::Request<'_>>,
|
||||
) -> ConduitResult<upload_signing_keys::Response> {
|
||||
|
@ -227,6 +231,8 @@ pub fn upload_signing_keys_route(
|
|||
)?;
|
||||
}
|
||||
|
||||
db.flush().await?;
|
||||
|
||||
Ok(upload_signing_keys::Response.into())
|
||||
}
|
||||
|
||||
|
@ -234,7 +240,7 @@ pub fn upload_signing_keys_route(
|
|||
feature = "conduit_bin",
|
||||
post("/_matrix/client/unstable/keys/signatures/upload", data = "<body>")
|
||||
)]
|
||||
pub fn upload_signatures_route(
|
||||
pub async fn upload_signatures_route(
|
||||
db: State<'_, Database>,
|
||||
body: Ruma<upload_signatures::Request>,
|
||||
) -> ConduitResult<upload_signatures::Response> {
|
||||
|
@ -285,6 +291,8 @@ pub fn upload_signatures_route(
|
|||
}
|
||||
}
|
||||
|
||||
db.flush().await?;
|
||||
|
||||
Ok(upload_signatures::Response.into())
|
||||
}
|
||||
|
||||
|
@ -292,7 +300,7 @@ pub fn upload_signatures_route(
|
|||
feature = "conduit_bin",
|
||||
get("/_matrix/client/r0/keys/changes", data = "<body>")
|
||||
)]
|
||||
pub fn get_key_changes_route(
|
||||
pub async fn get_key_changes_route(
|
||||
db: State<'_, Database>,
|
||||
body: Ruma<get_key_changes::Request<'_>>,
|
||||
) -> ConduitResult<get_key_changes::Response> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue