mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-17 23:20:51 +01:00
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:
parent
b4818716b8
commit
d45d033bf1
1 changed files with 5 additions and 2 deletions
|
@ -386,8 +386,6 @@ impl RoomEdus {
|
|||
.take_while(|(_, timestamp)| current_timestamp - timestamp > 5 * 60_000)
|
||||
// 5 Minutes
|
||||
{
|
||||
self.userid_lastpresenceupdate.remove(&user_id_bytes)?;
|
||||
|
||||
// Send new presence events to set the user offline
|
||||
let count = globals.next_count()?.to_be_bytes();
|
||||
let user_id = utils::string_from_bytes(&user_id_bytes)
|
||||
|
@ -421,6 +419,11 @@ impl RoomEdus {
|
|||
.expect("PresenceEvent can be serialized"),
|
||||
)?;
|
||||
}
|
||||
|
||||
self.userid_lastpresenceupdate.insert(
|
||||
&user_id.to_string().as_bytes(),
|
||||
&utils::millis_since_unix_epoch().to_be_bytes(),
|
||||
)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in a new issue