diff --git a/docs/usage/configuration/config_documentation.md b/docs/usage/configuration/config_documentation.md index 93b132b6e4..87c7729bd8 100644 --- a/docs/usage/configuration/config_documentation.md +++ b/docs/usage/configuration/config_documentation.md @@ -893,7 +893,7 @@ allowed_avatar_mimetypes: ["image/png", "image/jpeg", "image/gif"] How long to keep redacted events in unredacted form in the database. After this period redacted events get replaced with their redacted form in the DB. -Synapse will check whether the rentention period has concluded for redacted +Synapse will check whether the retention period has concluded for redacted events every 5 minutes. Thus, even if this option is set to `0`, Synapse may still take up to 5 minutes to purge redacted events from the database. @@ -904,6 +904,23 @@ Example configuration: redaction_retention_period: 28d ``` --- +--- +### `purge_retention_period` + +How long to keep locally forgotten room in the DB. After this period the room +will be fully purged from the DB. + +Synapse will check whether the retention period has concluded for room +purges every hour. Thus, even if this option is set to `0`, Synapse may +still take up to one hour to purge forgotten rooms from the database. + +Defaults to `7d`. Set to `null` to disable. + +Example configuration: +```yaml +purge_retention_period: 28d +``` +--- ### `user_ips_max_age` How long to track users' last seen time and IPs in the database. diff --git a/synapse/config/server.py b/synapse/config/server.py index 386c3194b8..e72fccd4ac 100644 --- a/synapse/config/server.py +++ b/synapse/config/server.py @@ -486,6 +486,15 @@ class ServerConfig(Config): else: self.redaction_retention_period = None + # How long to keep locally forgotten rooms before purging them. + purge_retention_period = config.get("purge_retention_period", "7d") + if purge_retention_period is not None: + self.purge_retention_period: Optional[int] = self.parse_duration( + purge_retention_period + ) + else: + self.purge_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: