Skip to content

Commit e8c9a0e

Browse files
committed
Randomize matrix-synapse-auto-compressor.timer start with a RandomizedDelaySec (defaults to 6h)
1 parent e1a2d42 commit e8c9a0e

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

docs/configuring-playbook-synapse-auto-compressor.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@ matrix_synapse_auto_compressor_enabled: true
2424
2525
### Edit the schedule (optional)
2626
27-
By default the task will run 0 a.m. every day based on the `matrix_synapse_auto_compressor_schedule` variable. It is defined in the format of systemd timer calendar.
27+
By default the task will around 0 a.m. every day based on the `matrix_synapse_auto_compressor_schedule` variable with a randomized delay of 6 hours (controlled by the `matrix_synapse_auto_compressor_schedule_randomized_delay_sec` variable). It is defined in the format of systemd timer calendar.
2828

2929
To edit the schedule, add the following configuration to your `vars.yml` file (adapt to your needs):
3030

3131
```yaml
3232
matrix_synapse_auto_compressor_schedule: "*-*-* 00:00:00"
33+
34+
# Consider adjusting the randomized delay or setting it to 0 to disable randomized delays.
35+
# matrix_synapse_auto_compressor_schedule_randomized_delay_sec: 6h
3336
```
3437

3538
### Extending the configuration

roles/custom/matrix-synapse-auto-compressor/defaults/main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,14 @@ matrix_synapse_auto_compressor_database_name: 'synapse'
6464
# connection string to synapse database (postgres only)
6565
matrix_synapse_auto_compressor_synapse_database: 'postgres://{{ matrix_synapse_auto_compressor_database_username | urlencode() }}:{{ matrix_synapse_auto_compressor_database_password | urlencode() }}@{{ matrix_synapse_auto_compressor_database_hostname }}:{{ matrix_synapse_auto_compressor_database_port }}/{{ matrix_synapse_auto_compressor_database_name }}'
6666

67-
# systemd calendar configuration for the compressor job
67+
# Controls the `OnCalendar` configuration for the compressor job.
68+
# Also see: `matrix_synapse_auto_compressor_schedule_randomized_delay_sec`
6869
matrix_synapse_auto_compressor_schedule: "*-*-* 00:00:00"
6970

71+
# The `RandomizedDelaySec` delay (in seconds or as a systemd time string) to randomize the `OnCalendar` start time (`matrix_synapse_auto_compressor_schedule`) of the compressor job.
72+
# This can be set to 0 to disable randomized delays.
73+
matrix_synapse_auto_compressor_schedule_randomized_delay_sec: 6h
74+
7075
# The number of state groups to work on at once.
7176
# All of the entries from state_groups_state are requested from the database for state groups that are worked on.
7277
# Therefore small chunk sizes may be needed on machines with low memory.

roles/custom/matrix-synapse-auto-compressor/templates/matrix-synapse-auto-compressor.timer.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Description=Synapse State Auto Compressor Timer
1111
[Timer]
1212
Unit=matrix-synapse-auto-compressor.service
1313
OnCalendar={{ matrix_synapse_auto_compressor_schedule }}
14+
RandomizedDelaySec={{ matrix_synapse_auto_compressor_schedule_randomized_delay_sec }}
1415

1516
[Install]
1617
WantedBy=timers.target

0 commit comments

Comments
 (0)