Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Add automatic purge after all users forget a room (#15488)
Browse files Browse the repository at this point in the history
 Also add restore of purge/shutdown rooms after a synapse restart.

Co-authored-by:  Eric Eastwood <[email protected]>
Co-authored-by: Erik Johnston <[email protected]>
  • Loading branch information
3 people committed Sep 15, 2023
1 parent 2a0f86f commit dd44ee0
Show file tree
Hide file tree
Showing 13 changed files with 542 additions and 450 deletions.
1 change: 1 addition & 0 deletions changelog.d/15488.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add automatic purge after all users forgotten a room. Also add restore of purge/shutdown rooms after a synapse restart.
11 changes: 11 additions & 0 deletions docs/usage/configuration/config_documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,17 @@ Example configuration:
redaction_retention_period: 28d
```
---
### `forgotten_room_retention_period`

How long to keep locally forgotten rooms before purging them from the DB.

Defaults to `null`, meaning it's disabled.

Example configuration:
```yaml
forgotten_room_retention_period: 28d
```
---
### `user_ips_max_age`

How long to track users' last seen time and IPs in the database.
Expand Down
2 changes: 2 additions & 0 deletions synapse/app/generic_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
)
from synapse.storage.databases.main.presence import PresenceStore
from synapse.storage.databases.main.profile import ProfileWorkerStore
from synapse.storage.databases.main.purge_events import PurgeEventsStore
from synapse.storage.databases.main.push_rule import PushRulesWorkerStore
from synapse.storage.databases.main.pusher import PusherWorkerStore
from synapse.storage.databases.main.receipts import ReceiptsWorkerStore
Expand Down Expand Up @@ -134,6 +135,7 @@ class GenericWorkerStore(
RelationsWorkerStore,
EventFederationWorkerStore,
EventPushActionsWorkerStore,
PurgeEventsStore,
StateGroupWorkerStore,
SignatureWorkerStore,
UserErasureWorkerStore,
Expand Down
11 changes: 11 additions & 0 deletions synapse/config/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,17 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
else:
self.redaction_retention_period = None

# How long to keep locally forgotten rooms before purging them from the DB.
forgotten_room_retention_period = config.get(
"forgotten_room_retention_period", None
)
if forgotten_room_retention_period is not None:
self.forgotten_room_retention_period: Optional[int] = self.parse_duration(
forgotten_room_retention_period
)
else:
self.forgotten_room_retention_period = None

# How long to keep entries in the `users_ips` table.
user_ips_max_age = config.get("user_ips_max_age", "28d")
if user_ips_max_age is not None:
Expand Down
Loading

0 comments on commit dd44ee0

Please sign in to comment.