0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-12 15:51:37 -05:00

Do not initialize mattermost error reporter if no uri is provided.

This commit is contained in:
Andrey Antukh 2021-07-07 10:26:04 +02:00
parent 65a4aff5fc
commit e1e825f350

View file

@ -40,7 +40,8 @@
(defmethod ig/init-key ::reporter
[_ {:keys [receiver uri] :as cfg}]
(l/info :msg "intializing mattermost error reporter" :uri uri)
(when uri
(l/info :msg "initializing mattermost error reporter" :uri uri)
(let [output (a/chan (a/sliding-buffer 128)
(filter #(= (:level %) "error")))]
(receiver :sub output)
@ -51,11 +52,12 @@
(do
(a/<! (handle-event cfg msg))
(recur)))))
output))
output)))
(defmethod ig/halt-key! ::reporter
[_ output]
(a/close! output))
(when output
(a/close! output)))
(defn- send-mattermost-notification!
[cfg {:keys [host version id] :as cdata}]
@ -110,7 +112,7 @@
(aa/with-thread executor
(try
(let [cdata (parse-event event)]
(when (and (:uri cfg) @enabled-mattermost)
(when @enabled-mattermost
(send-mattermost-notification! cfg cdata))
(persist-on-database! cfg cdata))
(catch Exception e