fix: send presence updates when going offline

remaining bug: conduit sends presence updates every 5 minutes even if
the user is already offline
This commit is contained in:
Timo Kösters 2021-01-10 17:12:16 +01:00
parent b4818716b8
commit d45d033bf1
No known key found for this signature in database
GPG Key ID: 24DA7517711A2BA4

View File

@ -386,8 +386,6 @@ impl RoomEdus {
.take_while(|(_, timestamp)| current_timestamp - timestamp > 5 * 60_000) .take_while(|(_, timestamp)| current_timestamp - timestamp > 5 * 60_000)
// 5 Minutes // 5 Minutes
{ {
self.userid_lastpresenceupdate.remove(&user_id_bytes)?;
// Send new presence events to set the user offline // Send new presence events to set the user offline
let count = globals.next_count()?.to_be_bytes(); let count = globals.next_count()?.to_be_bytes();
let user_id = utils::string_from_bytes(&user_id_bytes) let user_id = utils::string_from_bytes(&user_id_bytes)
@ -421,6 +419,11 @@ impl RoomEdus {
.expect("PresenceEvent can be serialized"), .expect("PresenceEvent can be serialized"),
)?; )?;
} }
self.userid_lastpresenceupdate.insert(
&user_id.to_string().as_bytes(),
&utils::millis_since_unix_epoch().to_be_bytes(),
)?;
} }
Ok(()) Ok(())