improvement: faster incoming transaction handling

This commit is contained in:
Timo Kösters 2021-08-19 11:01:18 +02:00
parent bf7e019a68
commit 46d8a46e1f
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
12 changed files with 365 additions and 280 deletions

View file

@ -292,6 +292,7 @@ pub async fn register_route(
is_direct: None,
third_party_invite: None,
blurhash: None,
reason: None,
})
.expect("event is valid, we just created it"),
unsigned: None,
@ -457,6 +458,7 @@ pub async fn register_route(
is_direct: None,
third_party_invite: None,
blurhash: None,
reason: None,
})
.expect("event is valid, we just created it"),
unsigned: None,
@ -478,6 +480,7 @@ pub async fn register_route(
is_direct: None,
third_party_invite: None,
blurhash: None,
reason: None,
})
.expect("event is valid, we just created it"),
unsigned: None,
@ -683,6 +686,7 @@ pub async fn deactivate_route(
is_direct: None,
third_party_invite: None,
blurhash: None,
reason: None,
};
let mutex_state = Arc::clone(

View file

@ -262,6 +262,7 @@ pub async fn ban_user_route(
is_direct: None,
third_party_invite: None,
blurhash: db.users.blurhash(&body.user_id)?,
reason: None,
}),
|event| {
let mut event = serde_json::from_value::<Raw<member::MemberEventContent>>(
@ -563,6 +564,7 @@ async fn join_room_by_id_helper(
is_direct: None,
third_party_invite: None,
blurhash: db.users.blurhash(&sender_user)?,
reason: None,
})
.expect("event is valid, we just created it"),
);
@ -695,6 +697,7 @@ async fn join_room_by_id_helper(
is_direct: None,
third_party_invite: None,
blurhash: db.users.blurhash(&sender_user)?,
reason: None,
};
db.rooms.build_and_append_pdu(
@ -846,6 +849,7 @@ pub async fn invite_helper<'a>(
membership: MembershipState::Invite,
third_party_invite: None,
blurhash: None,
reason: None,
})
.expect("member event is valid value");
@ -1040,6 +1044,7 @@ pub async fn invite_helper<'a>(
is_direct: Some(is_direct),
third_party_invite: None,
blurhash: db.users.blurhash(&user_id)?,
reason: None,
})
.expect("event is valid, we just created it"),
unsigned: None,

View file

@ -107,6 +107,7 @@ pub async fn create_room_route(
is_direct: Some(body.is_direct),
third_party_invite: None,
blurhash: db.users.blurhash(&sender_user)?,
reason: None,
})
.expect("event is valid, we just created it"),
unsigned: None,
@ -517,6 +518,7 @@ pub async fn upgrade_room_route(
is_direct: None,
third_party_invite: None,
blurhash: db.users.blurhash(&sender_user)?,
reason: None,
})
.expect("event is valid, we just created it"),
unsigned: None,

View file

@ -3,7 +3,10 @@ use crate::{database::DatabaseGuard, utils, ConduitResult, Error, Ruma};
use ruma::{
api::client::{
error::ErrorKind,
r0::session::{get_login_types, login, logout, logout_all},
r0::{
session::{get_login_types, login, logout, logout_all},
uiaa::IncomingUserIdentifier,
},
},
UserId,
};
@ -60,7 +63,7 @@ pub async fn login_route(
identifier,
password,
} => {
let username = if let login::IncomingUserIdentifier::MatrixId(matrix_id) = identifier {
let username = if let IncomingUserIdentifier::MatrixId(matrix_id) = identifier {
matrix_id
} else {
return Err(Error::BadRequest(ErrorKind::Forbidden, "Bad login type."));