0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-14 08:41:48 -05:00

🎉 Add proper logging reports on audit-log-archive task

This commit is contained in:
Andrey Antukh 2022-06-15 12:21:23 +02:00
parent dce479bc4b
commit adf2d82a52

View file

@ -257,12 +257,16 @@
(ex/raise :type :internal (ex/raise :type :internal
:code :task-not-configured :code :task-not-configured
:hint "archive task not configured, missing uri")) :hint "archive task not configured, missing uri"))
(when enabled (when enabled
(loop [] (loop [total 0]
(let [res (archive-events cfg)] (let [n (archive-events cfg)]
(when (= res :continue) (if n
(aa/thread-sleep 200) (do
(recur)))))))) (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 (def sql:retrieve-batch-of-audit-log
"select * from audit_log "select * from audit_log
@ -332,7 +336,7 @@
(l/debug :action "archive-events" :uri uri :events (count events)) (l/debug :action "archive-events" :uri uri :events (count events))
(when (send events) (when (send events)
(mark-as-archived conn rows) (mark-as-archived conn rows)
:continue)))))) (count events)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; GC Task ;; GC Task