From 8dba55d5cb165f42256858bbf44f41cf4d360433 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 29 Sep 2021 10:46:31 +0200 Subject: [PATCH] :paperclip: Port some auditlog changes from develop. --- backend/src/app/loggers/audit.clj | 14 ++++++-------- backend/src/app/main.clj | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/backend/src/app/loggers/audit.clj b/backend/src/app/loggers/audit.clj index d75fc1ce7..5f19403de 100644 --- a/backend/src/app/loggers/audit.clj +++ b/backend/src/app/loggers/audit.clj @@ -230,7 +230,7 @@ "select * from audit_log where archived_at is null order by created_at asc - limit 100 + limit 1000 for update skip locked;") (defn archive-events @@ -288,13 +288,11 @@ xform (comp (map decode-row) (map row->event)) events (into [] xform rows)] - (l/debug :action "archive-events" :uri uri :events (count events)) - (if (empty? events) - :empty - (do - (send events) - (mark-as-archived conn rows) - :continue)))))) + (when-not (empty? events) + (l/debug :action "archive-events" :uri uri :events (count events)) + (send events) + (mark-as-archived conn rows) + :continue))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; GC Task diff --git a/backend/src/app/main.clj b/backend/src/app/main.clj index bfa65c4d4..762474536 100644 --- a/backend/src/app/main.clj +++ b/backend/src/app/main.clj @@ -215,7 +215,7 @@ :task :audit-archive}) (when (cf/get :audit-archive-gc-enabled) - {:cron #app/cron "0 0 * * * ?" ;; every 1h + {:cron #app/cron "0 */3 * * * ?" ;; every 3m :task :audit-archive-gc}) (when (cf/get :telemetry-enabled)