From 89e64236b0e891cc24dfd462e46eea77187ce469 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 28 Sep 2022 09:42:39 +0200 Subject: [PATCH] :sparkles: Don't log exception on health check fail --- backend/src/app/http/debug.clj | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/src/app/http/debug.clj b/backend/src/app/http/debug.clj index 1133cd2a9..c66a14bd7 100644 --- a/backend/src/app/http/debug.clj +++ b/backend/src/app/http/debug.clj @@ -8,6 +8,7 @@ (:refer-clojure :exclude [error-handler]) (:require [app.common.exceptions :as ex] + [app.common.logging :as l] [app.common.pprint :as pp] [app.common.uuid :as uuid] [app.config :as cf] @@ -341,8 +342,13 @@ "Mainly a task that performs a health check." [{:keys [pool]} _] (db/with-atomic [conn pool] - (db/exec-one! conn ["select count(*) as count from server_prop;"]) - (yrs/response 200 "OK"))) + (try + (db/exec-one! conn ["select count(*) as count from server_prop;"]) + (yrs/response 200 "OK") + (catch Throwable cause + (l/warn :hint "unable to execute query on health handler" + :cause cause) + (yrs/response 503 "KO"))))) (defn changelog-handler [_ _]