From 6dccbc808e90a40df3c201edefb9b0b68800db44 Mon Sep 17 00:00:00 2001 From: projectmoon Date: Sun, 8 Nov 2020 20:47:39 +0000 Subject: [PATCH] Update 'Feature: Room State Management' --- Feature%3A-Room-State-Management.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Feature%3A-Room-State-Management.md b/Feature%3A-Room-State-Management.md index 9ca334e..67dea6a 100644 --- a/Feature%3A-Room-State-Management.md +++ b/Feature%3A-Room-State-Management.md @@ -10,7 +10,7 @@ Listen to Matrix event for when users enter and leave rooms. This is easily acco * When the bot joins a room for the first time, member events are fired for every member in the room. * It seems to sync everything, so you will get a join and leave notification many times, potentially. This is problematic for a few reasons. -* **Solution:** The simple solution in the beginning is to ignore any event more than a few seconds old, and then do a full sync of the users in the room when processing the join event. This works until there's a big network slowdown. +* **Solution:** The simple solution in the beginning is to ignore any event more than a few seconds old, and then do a full sync of the users in the room when processing the join event. This works until there's a big network slowdown, or something else happens. A more reliable solution is to simply track every single event ID in the database, and keep track of when it was processed. If it's in the database, do not process it again. If the bot is kicked or banned, it does not get events for users leaving a room. Instead, it will get a member event of leaving the room for itself. In that circumstance, it should delete all user information in the database for the room.