From 3ef83d5f33049ccf0f8d001f4938bcdd7fee82b4 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Tue, 29 May 2018 11:55:12 +0200 Subject: [PATCH] journalist notifications: today's submissions count 1h before reboot If the sysadmin chose to: a) activate journalist notifications b) modify the reboot time It is possible that the submissions count is older than expected. For instance, if the submissions count is done at midnight and the machine reboots at 11pm, the journalist will receive a submission count that is about 24h old and does not include submissions received in the past 23h00. The information sent to the journalist is correct, only it is older than one would expect. The submissions count is updated one hour before the machine reboots time so it is no more than one hour old, regardless of the reboot time chosen by the admin. --- install_files/ansible-base/group_vars/staging.yml | 1 + install_files/ansible-base/roles/app/tasks/setup_cron.yml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/install_files/ansible-base/group_vars/staging.yml b/install_files/ansible-base/group_vars/staging.yml index 1f2d934343..9914aa80c3 100644 --- a/install_files/ansible-base/group_vars/staging.yml +++ b/install_files/ansible-base/group_vars/staging.yml @@ -64,3 +64,4 @@ install_local_packages: true # the Apache service is configured correctly. securedrop_app_install_from_repo: False +daily_reboot_time: 4 # An integer between 0 and 23 diff --git a/install_files/ansible-base/roles/app/tasks/setup_cron.yml b/install_files/ansible-base/roles/app/tasks/setup_cron.yml index ced6fea7ce..37af128b00 100644 --- a/install_files/ansible-base/roles/app/tasks/setup_cron.yml +++ b/install_files/ansible-base/roles/app/tasks/setup_cron.yml @@ -20,6 +20,7 @@ cron: name: Update the number of submissions in the past 24h job: "{{ securedrop_code }}/manage.py were-there-submissions-today" - special_time: daily + # 0 -> 23, 1 -> 0, 2 -> 1, ... 23 -> 22 + hour: "{{ (daily_reboot_time + 23) % 24 }}" tags: - cron