style(presence): reformat

This commit is contained in:
Jakub Kubík 2022-11-21 21:50:30 +01:00
parent 8d161c6a36
commit 230f09f8f7
No known key found for this signature in database
GPG key ID: D3A0D5D60F3A173F
2 changed files with 19 additions and 12 deletions

View file

@ -225,7 +225,8 @@ impl service::rooms::edus::presence::Data for KeyValueDatabase {
// TODO: Get rid of this hack (hinting correct types to rustc)
timers.push(create_presence_timer(
Duration::from_secs(1),
UserId::parse_with_server_name("conduit", services().globals.server_name()).expect("Conduit user always exists")
UserId::parse_with_server_name("conduit", services().globals.server_name())
.expect("Conduit user always exists"),
));
tokio::spawn(async move {
@ -306,7 +307,8 @@ impl service::rooms::edus::presence::Data for KeyValueDatabase {
tokio::spawn(async move {
loop {
let mut removed_events: u64 = 0;
let age_limit_curr = millis_since_unix_epoch().saturating_sub(age_limit.as_millis() as u64);
let age_limit_curr =
millis_since_unix_epoch().saturating_sub(age_limit.as_millis() as u64);
for user_id in userid_presenceupdate
.iter()
@ -317,8 +319,9 @@ impl service::rooms::edus::presence::Data for KeyValueDatabase {
.expect("UserID bytes are a valid string"),
)
.expect("UserID bytes from database are a valid UserID"),
PresenceUpdate::from_be_bytes(&update_bytes)
.expect("PresenceUpdate bytes from database are a valid PresenceUpdate"),
PresenceUpdate::from_be_bytes(&update_bytes).expect(
"PresenceUpdate bytes from database are a valid PresenceUpdate",
),
)
})
.filter_map(|(user_id, presence_update)| {
@ -335,9 +338,13 @@ impl service::rooms::edus::presence::Data for KeyValueDatabase {
.rooms_joined(&user_id)
.filter_map(|room_id| room_id.ok())
{
match roomuserid_presenceevent.remove(&*[room_id.as_bytes(), &[0xff], user_id.as_bytes()].concat()) {
match roomuserid_presenceevent
.remove(&*[room_id.as_bytes(), &[0xff], user_id.as_bytes()].concat())
{
Ok(_) => removed_events += 1,
Err(e) => error!("An errord occured while removing a stale presence event: {e}")
Err(e) => error!(
"An errord occured while removing a stale presence event: {e}"
),
}
}
}