From 036b1156f2abaa3ba5669e4b549cb195cfe1c3c9 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 14 Dec 2023 08:59:15 -0800 Subject: [PATCH] zilencer: Avoid using stale last_audit_log_update. --- zilencer/views.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/zilencer/views.py b/zilencer/views.py index 4310ee8551..d8692fdbc2 100644 --- a/zilencer/views.py +++ b/zilencer/views.py @@ -976,9 +976,8 @@ def remote_server_post_analytics( # We need to update 'last_audit_log_update' before calling the # 'sync_license_ledger_if_needed' method to avoid 'MissingDataError' # due to 'has_stale_audit_log' being True. - RemoteZulipServer.objects.filter(uuid=server.uuid).update( - last_audit_log_update=timezone_now() - ) + server.last_audit_log_update = timezone_now() + server.save(update_fields=["last_audit_log_update"]) # Update LicenseLedger for remote_realm customers using logs in RemoteRealmAuditlog. for remote_realm in remote_realms_set: