From adf2d82a52749bad970ed5103c57f86207c285e5 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 15 Jun 2022 12:21:23 +0200 Subject: [PATCH] :tada: Add proper logging reports on audit-log-archive task --- backend/src/app/loggers/audit.clj | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/backend/src/app/loggers/audit.clj b/backend/src/app/loggers/audit.clj index 8b5a8c2ec..8fb9ce6b9 100644 --- a/backend/src/app/loggers/audit.clj +++ b/backend/src/app/loggers/audit.clj @@ -257,12 +257,16 @@ (ex/raise :type :internal :code :task-not-configured :hint "archive task not configured, missing uri")) + (when enabled - (loop [] - (let [res (archive-events cfg)] - (when (= res :continue) - (aa/thread-sleep 200) - (recur)))))))) + (loop [total 0] + (let [n (archive-events cfg)] + (if n + (do + (aa/thread-sleep 200) + (recur (+ total n))) + (when (pos? total) + (l/trace :hint "events chunk archived" :num total))))))))) (def sql:retrieve-batch-of-audit-log "select * from audit_log @@ -332,7 +336,7 @@ (l/debug :action "archive-events" :uri uri :events (count events)) (when (send events) (mark-as-archived conn rows) - :continue)))))) + (count events))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; GC Task