From d0f761172ad636b3fd3735fac2ec1b2facaf88ed Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 14 Oct 2021 11:51:59 +0200 Subject: [PATCH] :sparkles: Avoid unnecesary error report on audit module. --- backend/src/app/loggers/audit.clj | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/backend/src/app/loggers/audit.clj b/backend/src/app/loggers/audit.clj index e7e4368ab..e312ebba2 100644 --- a/backend/src/app/loggers/audit.clj +++ b/backend/src/app/loggers/audit.clj @@ -272,11 +272,12 @@ :headers headers :body body} resp (http/send! params)] - (when (not= (:status resp) 204) - (ex/raise :type :internal - :code :unable-to-send-events - :hint "unable to send events" - :context resp)))) + (if (= (:status resp) 204) + true + (do + (l/warn :hint "unable to archive events" + :resp-status (:status resp)) + false)))) (mark-as-archived [conn rows] (db/exec-one! conn ["update audit_log set archived_at=now() where id = ANY(?)" @@ -291,9 +292,9 @@ events (into [] xform rows)] (when-not (empty? events) (l/debug :action "archive-events" :uri uri :events (count events)) - (send events) - (mark-as-archived conn rows) - :continue))))) + (when (send events) + (mark-as-archived conn rows) + :continue)))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; GC Task