Avoid unnecesary error report on audit module.

This commit is contained in:
Andrey Antukh 2021-10-14 11:51:59 +02:00
parent fd6a8aec71
commit d0f761172a

View file

@ -272,11 +272,12 @@
:headers headers :headers headers
:body body} :body body}
resp (http/send! params)] resp (http/send! params)]
(when (not= (:status resp) 204) (if (= (:status resp) 204)
(ex/raise :type :internal true
:code :unable-to-send-events (do
:hint "unable to send events" (l/warn :hint "unable to archive events"
:context resp)))) :resp-status (:status resp))
false))))
(mark-as-archived [conn rows] (mark-as-archived [conn rows]
(db/exec-one! conn ["update audit_log set archived_at=now() where id = ANY(?)" (db/exec-one! conn ["update audit_log set archived_at=now() where id = ANY(?)"
@ -291,9 +292,9 @@
events (into [] xform rows)] events (into [] xform rows)]
(when-not (empty? events) (when-not (empty? events)
(l/debug :action "archive-events" :uri uri :events (count events)) (l/debug :action "archive-events" :uri uri :events (count events))
(send events) (when (send events)
(mark-as-archived conn rows) (mark-as-archived conn rows)
:continue))))) :continue))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; GC Task ;; GC Task