-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Purge room when all users have forgotten it #12170
Conversation
Signed-off-by: Jelle Besseling <jelle@pingiun.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some tests please? Just a couple to check that we don't purge rooms unless everyone has forgotten the room, and one to check that forgetting then rejoining the room works. I'm just very paranoid when it comes to things that delete lots of data 🙂
Thanks for this!
"purge_room_after_last_forget", | ||
self.storage.purge_events.purge_room, | ||
room_id, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an OK first step, but it does mean that if the server gets restarted before the purge is completed it won't be retried.
One option would be to check if we need to purge the room and if so write that to a DB table, and once purged we can remove it from the table.
That can be a separate PR though I think
Co-authored-by: Erik Johnston <erikj@jki.re>
Co-authored-by: Erik Johnston <erikj@jki.re>
I think the failing tests are unrelated to my changes? Not sure |
Maybe my suggestion accidentally included a trailing whitespace? Hard to tell on the web IDE |
I'll fix it when I add the tests. My previous comment was about other failing tests: https://github.com/matrix-org/synapse/actions/runs/1938567513 |
Oh, sorry! Yeah, that looks like a flakey test to me, since its just failed on one run and appears unrelated. |
Hi @pingiun. Are you able to continue working on this? If you need help with writing tests, I'd suggest taking a look at an existing unit test and adapting it. Awkwardly I'd point you to some existing unit tests for forgetting a room, but it looks like we only have integration tests for that functionality! I'd instead suggest creating a new testfile in tests/rest/client/ named |
Closing this PR as it seems to have been abandoned. If you'd like to continue working on this, feel free to re-open / create a new PR. Thanks! |
Somewhat adresses #4720, based on comment: #4720 (comment)
This will only work for newly forgotten rooms, and only rooms that are completely forgotten by all users. This is not a general fix for people who want to remove rooms after some time and after they have been left by everyone.
Signed-off-by: Jelle Besseling jelle@pingiun.com
Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.(run the linters)