examples: Add some whitespace to the autojoin example.

master
Damir Jelić 2020-10-12 12:50:03 +02:00
parent c4ac0d0570
commit 0ab12fe969
1 changed files with 6 additions and 2 deletions

View File

@ -35,15 +35,19 @@ impl EventEmitter for AutoJoinBot {
let room = room.read().await; let room = room.read().await;
println!("Autojoining room {}", room.room_id); println!("Autojoining room {}", room.room_id);
let mut delay = 2; let mut delay = 2;
while let Err(err) = self.client.join_room_by_id(&room.room_id).await { while let Err(err) = self.client.join_room_by_id(&room.room_id).await {
// retry autojoin due to synapse sending invites, before the invited user can join // retry autojoin due to synapse sending invites, before the
// for more information see https://github.com/matrix-org/synapse/issues/4345 // invited user can join for more information see
// https://github.com/matrix-org/synapse/issues/4345
eprintln!( eprintln!(
"Failed to join room {} ({:?}), retrying in {}s", "Failed to join room {} ({:?}), retrying in {}s",
room.room_id, err, delay room.room_id, err, delay
); );
delay_for(Duration::from_secs(delay)).await; delay_for(Duration::from_secs(delay)).await;
delay *= 2; delay *= 2;
if delay > 3600 { if delay > 3600 {
eprintln!("Can't join room {} ({:?})", room.room_id, err); eprintln!("Can't join room {} ({:?})", room.room_id, err);
break; break;