diff --git a/docs/configuring-playbook-synapse-auto-compressor.md b/docs/configuring-playbook-synapse-auto-compressor.md index 4934e65a0..88ea56604 100644 --- a/docs/configuring-playbook-synapse-auto-compressor.md +++ b/docs/configuring-playbook-synapse-auto-compressor.md @@ -24,12 +24,15 @@ matrix_synapse_auto_compressor_enabled: true ### Edit the schedule (optional) -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. +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. To edit the schedule, add the following configuration to your `vars.yml` file (adapt to your needs): ```yaml matrix_synapse_auto_compressor_schedule: "*-*-* 00:00:00" + +# Consider adjusting the randomized delay or setting it to 0 to disable randomized delays. +# matrix_synapse_auto_compressor_schedule_randomized_delay_sec: 6h ``` ### Extending the configuration diff --git a/roles/custom/matrix-synapse-auto-compressor/defaults/main.yml b/roles/custom/matrix-synapse-auto-compressor/defaults/main.yml index 78a07a9ed..c627288f1 100644 --- a/roles/custom/matrix-synapse-auto-compressor/defaults/main.yml +++ b/roles/custom/matrix-synapse-auto-compressor/defaults/main.yml @@ -64,9 +64,14 @@ matrix_synapse_auto_compressor_database_name: 'synapse' # connection string to synapse database (postgres only) 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 }}' -# systemd calendar configuration for the compressor job +# Controls the `OnCalendar` configuration for the compressor job. +# Also see: `matrix_synapse_auto_compressor_schedule_randomized_delay_sec` matrix_synapse_auto_compressor_schedule: "*-*-* 00:00:00" +# 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. +# This can be set to 0 to disable randomized delays. +matrix_synapse_auto_compressor_schedule_randomized_delay_sec: 6h + # The number of state groups to work on at once. # All of the entries from state_groups_state are requested from the database for state groups that are worked on. # Therefore small chunk sizes may be needed on machines with low memory. diff --git a/roles/custom/matrix-synapse-auto-compressor/templates/matrix-synapse-auto-compressor.timer.j2 b/roles/custom/matrix-synapse-auto-compressor/templates/matrix-synapse-auto-compressor.timer.j2 index 1bced0d46..9425b2841 100644 --- a/roles/custom/matrix-synapse-auto-compressor/templates/matrix-synapse-auto-compressor.timer.j2 +++ b/roles/custom/matrix-synapse-auto-compressor/templates/matrix-synapse-auto-compressor.timer.j2 @@ -11,6 +11,7 @@ Description=Synapse State Auto Compressor Timer [Timer] Unit=matrix-synapse-auto-compressor.service OnCalendar={{ matrix_synapse_auto_compressor_schedule }} +RandomizedDelaySec={{ matrix_synapse_auto_compressor_schedule_randomized_delay_sec }} [Install] WantedBy=timers.target