mirror of
https://github.com/penpot/penpot.git
synced 2025-03-14 16:51:18 -05:00
✨ Do not initialize mattermost error reporter if no uri is provided.
This commit is contained in:
parent
65a4aff5fc
commit
e1e825f350
1 changed files with 16 additions and 14 deletions
|
@ -40,7 +40,8 @@
|
||||||
|
|
||||||
(defmethod ig/init-key ::reporter
|
(defmethod ig/init-key ::reporter
|
||||||
[_ {:keys [receiver uri] :as cfg}]
|
[_ {: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)
|
(let [output (a/chan (a/sliding-buffer 128)
|
||||||
(filter #(= (:level %) "error")))]
|
(filter #(= (:level %) "error")))]
|
||||||
(receiver :sub output)
|
(receiver :sub output)
|
||||||
|
@ -51,11 +52,12 @@
|
||||||
(do
|
(do
|
||||||
(a/<! (handle-event cfg msg))
|
(a/<! (handle-event cfg msg))
|
||||||
(recur)))))
|
(recur)))))
|
||||||
output))
|
output)))
|
||||||
|
|
||||||
(defmethod ig/halt-key! ::reporter
|
(defmethod ig/halt-key! ::reporter
|
||||||
[_ output]
|
[_ output]
|
||||||
(a/close! output))
|
(when output
|
||||||
|
(a/close! output)))
|
||||||
|
|
||||||
(defn- send-mattermost-notification!
|
(defn- send-mattermost-notification!
|
||||||
[cfg {:keys [host version id] :as cdata}]
|
[cfg {:keys [host version id] :as cdata}]
|
||||||
|
@ -110,7 +112,7 @@
|
||||||
(aa/with-thread executor
|
(aa/with-thread executor
|
||||||
(try
|
(try
|
||||||
(let [cdata (parse-event event)]
|
(let [cdata (parse-event event)]
|
||||||
(when (and (:uri cfg) @enabled-mattermost)
|
(when @enabled-mattermost
|
||||||
(send-mattermost-notification! cfg cdata))
|
(send-mattermost-notification! cfg cdata))
|
||||||
(persist-on-database! cfg cdata))
|
(persist-on-database! cfg cdata))
|
||||||
(catch Exception e
|
(catch Exception e
|
||||||
|
|
Loading…
Add table
Reference in a new issue