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

Commit 9e66f37

Browse files
authored
Update documentation on retention policies limits (#8529)
* Update documentation on retention policies limits Document the changes from #8104
1 parent 1264c8a commit 9e66f37

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

changelog.d/8529.doc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Document the new behaviour of the `allowed_lifetime_min` and `allowed_lifetime_max` settings in the room retention configuration.

docs/message_retention_policies.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -136,24 +136,34 @@ the server's database.
136136

137137
### Lifetime limits
138138

139-
**Note: this feature is mainly useful within a closed federation or on
140-
servers that don't federate, because there currently is no way to
141-
enforce these limits in an open federation.**
142-
143-
Server admins can restrict the values their local users are allowed to
144-
use for both `min_lifetime` and `max_lifetime`. These limits can be
145-
defined as such in the `retention` section of the configuration file:
139+
Server admins can set limits on the values of `max_lifetime` to use when
140+
purging old events in a room. These limits can be defined as such in the
141+
`retention` section of the configuration file:
146142

147143
```yaml
148144
allowed_lifetime_min: 1d
149145
allowed_lifetime_max: 1y
150146
```
151147

152-
Here, `allowed_lifetime_min` is the lowest value a local user can set
153-
for both `min_lifetime` and `max_lifetime`, and `allowed_lifetime_max`
154-
is the highest value. Both parameters are optional (e.g. setting
155-
`allowed_lifetime_min` but not `allowed_lifetime_max` only enforces a
156-
minimum and no maximum).
148+
The limits are considered when running purge jobs. If necessary, the
149+
effective value of `max_lifetime` will be brought between
150+
`allowed_lifetime_min` and `allowed_lifetime_max` (inclusive).
151+
This means that, if the value of `max_lifetime` defined in the room's state
152+
is lower than `allowed_lifetime_min`, the value of `allowed_lifetime_min`
153+
will be used instead. Likewise, if the value of `max_lifetime` is higher
154+
than `allowed_lifetime_max`, the value of `allowed_lifetime_max` will be
155+
used instead.
156+
157+
In the example above, we ensure Synapse never deletes events that are less
158+
than one day old, and that it always deletes events that are over a year
159+
old.
160+
161+
If a default policy is set, and its `max_lifetime` value is lower than
162+
`allowed_lifetime_min` or higher than `allowed_lifetime_max`, the same
163+
process applies.
164+
165+
Both parameters are optional; if one is omitted Synapse won't use it to
166+
adjust the effective value of `max_lifetime`.
157167

158168
Like other settings in this section, these parameters can be expressed
159169
either as a duration or as a number of milliseconds.

0 commit comments

Comments
 (0)