From 0f7372bfb4a18d243835c024279055ada401bf4f Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 18 Jan 2021 15:28:46 +0100 Subject: [PATCH] :bug: Fix NPE on notifications module (on abrupt disconnect). --- backend/src/app/notifications.clj | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/backend/src/app/notifications.clj b/backend/src/app/notifications.clj index 347a51ea7..1afd3123d 100644 --- a/backend/src/app/notifications.clj +++ b/backend/src/app/notifications.clj @@ -99,6 +99,15 @@ ;; (mtx/counter {:id "notificatons__messages_counter" ;; :help "A total number of messages handled by the notifications service."})) +(defn- ws-send + [conn data] + (try + (when (jetty/connected? conn) + (jetty/send! conn data) + true) + (catch java.lang.NullPointerException e + false))) + (defn websocket [{:keys [file-id team-id redis] :as cfg}] (let [in (a/chan 32) @@ -114,8 +123,8 @@ (a/go-loop [] (let [val (a/