improvement: flush after every request that manipulates the db

This commit is contained in:
Timo Kösters 2020-10-21 21:28:02 +02:00
parent b2a1505535
commit 6dbe195695
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
30 changed files with 216 additions and 105 deletions

View file

@ -14,7 +14,7 @@ use std::convert::TryInto;
const MXC_LENGTH: usize = 32;
#[cfg_attr(feature = "conduit_bin", get("/_matrix/media/r0/config"))]
pub fn get_media_config_route(
pub async fn get_media_config_route(
db: State<'_, Database>,
) -> ConduitResult<get_media_config::Response> {
Ok(get_media_config::Response {
@ -27,7 +27,7 @@ pub fn get_media_config_route(
feature = "conduit_bin",
post("/_matrix/media/r0/upload", data = "<body>")
)]
pub fn create_content_route(
pub async fn create_content_route(
db: State<'_, Database>,
body: Ruma<create_content::Request<'_>>,
) -> ConduitResult<create_content::Response> {
@ -43,6 +43,8 @@ pub fn create_content_route(
&body.file,
)?;
db.flush().await?;
Ok(create_content::Response { content_uri: mxc }.into())
}