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 crate::{services, Error, Result, Ruma};
|
||||||
|
use rand::seq::SliceRandom;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::{
|
api::{
|
||||||
|
@ -90,10 +91,10 @@ pub(crate) async fn get_alias_helper(
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
return Ok(get_alias::v3::Response::new(
|
let mut servers = response.servers;
|
||||||
response.room_id,
|
servers.shuffle(&mut rand::thread_rng());
|
||||||
response.servers,
|
|
||||||
));
|
return Ok(get_alias::v3::Response::new(response.room_id, servers));
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut room_id = None;
|
let mut room_id = None;
|
||||||
|
|
|
@ -112,7 +112,7 @@ pub async fn join_room_by_id_or_alias_route(
|
||||||
Err(room_alias) => {
|
Err(room_alias) => {
|
||||||
let response = get_alias_helper(room_alias).await?;
|
let response = get_alias_helper(room_alias).await?;
|
||||||
|
|
||||||
(response.servers.into_iter().collect(), response.room_id)
|
(response.servers, response.room_id)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue