Skip to content

Commit 6d048d3

Browse files
fix(metrics): compute the weekly email without the query cache
The Saturday email read through the metrics query cache and could serve stale values; compute it fresh (use_cache=False) so the email and the freshly warmed dashboard cache match. Signed-off-by: Alan Peixinho <alan.peixinho@profusion.mobi> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 0bdc212 commit 6d048d3

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

backend/kernelCI_app/management/commands/notifications.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,7 @@ def generate_metrics_report(
860860
data: MetricsReportData = get_metrics_data(
861861
start_days_ago=start_days_ago,
862862
end_days_ago=end_days_ago,
863+
use_cache=False,
863864
)
864865

865866
deltas = compute_metrics_deltas(data)

backend/kernelCI_app/tests/unitTests/commands/metrics_notifications_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,9 @@ def test_default_success(self, mock_instance, mock_get, mock_template, mock_send
224224
mock_get.return_value = make_metrics_data()
225225
mock_template.return_value.render.return_value = "rendered content"
226226
generate_metrics_report(email_service=MagicMock(), email_args=MagicMock())
227-
mock_get.assert_called_once_with(start_days_ago=7, end_days_ago=0)
227+
mock_get.assert_called_once_with(
228+
start_days_ago=7, end_days_ago=0, use_cache=False
229+
)
228230
mock_template.assert_called_once_with("metrics_report.txt.j2")
229231
mock_instance.assert_called_once()
230232
mock_send.assert_called_once()

0 commit comments

Comments
 (0)