mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 21:44:52 -04:00
Allow configuring a range for the account validity startup job
When enabling the account validity feature, Synapse will look at startup for registered account without an expiration date, and will set one equals to 'now + validity_period' for them. On large servers, it can mean that a large number of users will have the same expiration date, which means that they will all be sent a renewal email at the same time, which isn't ideal. In order to mitigate this, this PR allows server admins to define a 'max_delta' so that the expiration date is a random value in the [now + validity_period ; now + validity_period + max_delta] range. This allows renewal emails to be progressively sent over a configured period instead of being sent all in one big batch.
This commit is contained in:
parent
ddd30f44a0
commit
52839886d6
3 changed files with 53 additions and 2 deletions
|
@ -39,6 +39,10 @@ class AccountValidityConfig(Config):
|
|||
else:
|
||||
self.renew_email_subject = "Renew your %(app)s account"
|
||||
|
||||
self.startup_job_max_delta = self.parse_duration(
|
||||
config.get("startup_job_max_delta", 0),
|
||||
)
|
||||
|
||||
if self.renew_by_email_enabled and "public_baseurl" not in synapse_config:
|
||||
raise ConfigError("Can't send renewal emails without 'public_baseurl'")
|
||||
|
||||
|
@ -131,11 +135,18 @@ class RegistrationConfig(Config):
|
|||
# after that the validity period changes and Synapse is restarted, the users'
|
||||
# expiration dates won't be updated unless their account is manually renewed.
|
||||
#
|
||||
# If set, the ``startup_job_max_delta`` optional setting will make the startup job
|
||||
# described above set a random expiration date between t + period and
|
||||
# t + period + startup_job_max_delta, t being the date and time at which the job
|
||||
# sets the expiration date for a given user. This is useful for server admins that
|
||||
# want to avoid Synapse sending a lot of renewal emails at once.
|
||||
#
|
||||
#account_validity:
|
||||
# enabled: True
|
||||
# period: 6w
|
||||
# renew_at: 1w
|
||||
# renew_email_subject: "Renew your %%(app)s account"
|
||||
# startup_job_max_delta: 2d
|
||||
|
||||
# The user must provide all of the below types of 3PID when registering.
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue