mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-06-27 16:35:59 +00:00
refactor(appservices): avoid cloning frequently
This commit is contained in:
parent
5c650bb67e
commit
b20483aa13
7 changed files with 44 additions and 40 deletions
|
@ -17,9 +17,7 @@ pub(crate) async fn send_request<T: OutgoingRequest>(
|
|||
where
|
||||
T: Debug,
|
||||
{
|
||||
let Some(destination) = registration.url else {
|
||||
return None;
|
||||
};
|
||||
let destination = registration.url?;
|
||||
|
||||
let hs_token = registration.hs_token.as_str();
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ pub(crate) async fn get_alias_helper(
|
|||
match services().rooms.alias.resolve_local_alias(&room_alias)? {
|
||||
Some(r) => room_id = Some(r),
|
||||
None => {
|
||||
for appservice in services().appservice.all().await {
|
||||
for appservice in services().appservice.read().await.values() {
|
||||
if appservice.aliases.is_match(room_alias.as_str())
|
||||
&& if let Some(opt_result) = services()
|
||||
.sending
|
||||
|
|
|
@ -80,10 +80,11 @@ where
|
|||
|
||||
let mut json_body = serde_json::from_slice::<CanonicalJsonValue>(&body).ok();
|
||||
|
||||
let appservices = services().appservice.all().await;
|
||||
let appservice_registration = appservices
|
||||
.iter()
|
||||
.find(|info| Some(info.registration.as_token.as_str()) == token);
|
||||
let appservice_registration = if let Some(token) = token {
|
||||
services().appservice.find_from_token(token).await
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let (sender_user, sender_device, sender_servername, from_appservice) =
|
||||
if let Some(info) = appservice_registration {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue