mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-13 18:31:04 +01:00
Merge branch 'joinfix' into 'next'
improvement: randomize server order for alias joins See merge request famedly/conduit!491
This commit is contained in:
commit
6a6f8e80f1
2 changed files with 6 additions and 5 deletions
|
@ -1,4 +1,5 @@
|
|||
use crate::{services, Error, Result, Ruma};
|
||||
use rand::seq::SliceRandom;
|
||||
use regex::Regex;
|
||||
use ruma::{
|
||||
api::{
|
||||
|
@ -90,10 +91,10 @@ pub(crate) async fn get_alias_helper(
|
|||
)
|
||||
.await?;
|
||||
|
||||
return Ok(get_alias::v3::Response::new(
|
||||
response.room_id,
|
||||
response.servers,
|
||||
));
|
||||
let mut servers = response.servers;
|
||||
servers.shuffle(&mut rand::thread_rng());
|
||||
|
||||
return Ok(get_alias::v3::Response::new(response.room_id, servers));
|
||||
}
|
||||
|
||||
let mut room_id = None;
|
||||
|
|
|
@ -112,7 +112,7 @@ pub async fn join_room_by_id_or_alias_route(
|
|||
Err(room_alias) => {
|
||||
let response = get_alias_helper(room_alias).await?;
|
||||
|
||||
(response.servers.into_iter().collect(), response.room_id)
|
||||
(response.servers, response.room_id)
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue