From d76baa32668d118c85ecc27c1db84120e4e35c36 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 20 Feb 2023 13:13:17 +0100 Subject: [PATCH] :arrow_up: Update promesa dependency And adapt all code for breaking changes --- backend/src/app/loggers/database.clj | 21 +++++++++++++-------- backend/src/app/loggers/mattermost.clj | 3 ++- common/deps.edn | 8 ++++++-- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/backend/src/app/loggers/database.clj b/backend/src/app/loggers/database.clj index 110327273..566057a1c 100644 --- a/backend/src/app/loggers/database.clj +++ b/backend/src/app/loggers/database.clj @@ -62,6 +62,11 @@ (dissoc ::s/problems ::s/value ::s/spec :hint) (pp/pprint-str :width 200))}))) +(defn error-record? + [{:keys [::l/level ::l/cause]}] + (and (= :error level) + (ex/exception? cause))) + (defn- handle-event [{:keys [::db/pool]} {:keys [::l/id] :as record}] (try @@ -74,20 +79,20 @@ (catch Throwable cause (l/warn :hint "unexpected exception on database error logger" :cause cause)))) -(defn error-record? - [{:keys [::l/level ::l/cause]}] - (and (= :error level) - (ex/exception? cause))) - (defmethod ig/pre-init-spec ::reporter [_] (s/keys :req [::db/pool])) (defmethod ig/init-key ::reporter [_ cfg] - (let [input (sp/chan (sp/sliding-buffer 32) (filter error-record?))] + (let [input (sp/chan :buf (sp/sliding-buffer 32) + :xf (filter error-record?))] (add-watch l/log-record ::reporter #(sp/put! input %4)) - (px/thread - {:name "penpot/database-reporter" :virtual true} + + ;; FIXME: we don't use virtual threads here until JDBC is uptaded + ;; to >= 42.6.0 bacause it has the necessary fixes fro make the + ;; JDBC driver properly compatible with Virtual Threads. + + (px/thread {:name "penpot/database-reporter" :virtual false} (l/info :hint "initializing database error persistence") (try (loop [] diff --git a/backend/src/app/loggers/mattermost.clj b/backend/src/app/loggers/mattermost.clj index 51a627ff1..09552c767 100644 --- a/backend/src/app/loggers/mattermost.clj +++ b/backend/src/app/loggers/mattermost.clj @@ -77,7 +77,8 @@ {:name "penpot/mattermost-reporter" :virtual true} (l/info :hint "initializing error reporter" :uri uri) - (let [input (sp/chan (sp/sliding-buffer 128) (filter ldb/error-record?))] + (let [input (sp/chan :buf (sp/sliding-buffer 128) + :xf (filter ldb/error-record?))] (add-watch l/log-record ::reporter #(sp/put! input %4)) (try (loop [] diff --git a/common/deps.edn b/common/deps.edn index 738b5144a..54d4237ee 100644 --- a/common/deps.edn +++ b/common/deps.edn @@ -23,15 +23,19 @@ com.cognitect/transit-cljs {:mvn/version "0.8.280"} java-http-clj/java-http-clj {:mvn/version "0.4.3"} - funcool/promesa {:mvn/version "10.0.594"} funcool/cuerdas {:mvn/version "2022.06.16-403"} + funcool/promesa + {:git/tag "11.0-alpha13" + :git/sha "f6cab38" + :git/url "https://github.com/funcool/promesa.git"} lambdaisland/uri {:mvn/version "1.13.95" :exclusions [org.clojure/data.json]} frankiesardo/linked {:mvn/version "1.3.0"} - funcool/datoteka {:mvn/version "3.0.66"} + funcool/datoteka {:mvn/version "3.0.66" + :exclusions [funcool/promesa]} com.sun.mail/jakarta.mail {:mvn/version "2.0.1"} org.la4j/la4j {:mvn/version "0.6.0"}