0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-25 07:58:49 -05:00

Revert "📎 Allow set statement timeout on db module"

This reverts commit 70028e1371.
This commit is contained in:
Andrey Antukh 2022-07-04 14:04:56 +02:00
parent 70028e1371
commit 356ff4683d

View file

@ -7,7 +7,6 @@
(ns app.db
(:require
[app.common.data :as d]
[app.common.data.macros :as dm]
[app.common.exceptions :as ex]
[app.common.geom.point :as gpt]
[app.common.logging :as l]
@ -61,22 +60,17 @@
(s/def ::validation-timeout ::us/integer)
(s/def ::read-only? ::us/boolean)
(s/def ::statement-timeout ::us/integer)
(s/def ::idle-in-transaction-timeout ::us/integer)
(s/def ::pool-options
(s/keys :opt-un [::uri ::name
::min-size
::max-size
::connection-timeout
::validation-timeout
::statement-timeout
::idle-in-transaction-timeout
::migrations
::username
::password
::read-only?
::mtx/metrics]))
::mtx/metrics
::read-only?]))
(def defaults
{:name :main
@ -86,8 +80,6 @@
:validation-timeout 10000
:idle-timeout 120000 ; 2min
:max-lifetime 1800000 ; 30m
:statement-timeout 300000
:idle-in-transaction-timeout 300000
:read-only? false})
(defmethod ig/prep-key ::pool
@ -135,6 +127,10 @@
;; API & Impl
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def initsql
(str "SET statement_timeout = 300000;\n"
"SET idle_in_transaction_session_timeout = 300000;"))
(defn- create-datasource-config
[{:keys [metrics uri] :as cfg}]
(let [config (HikariConfig.)]
@ -149,11 +145,7 @@
(.setMaxLifetime (:max-lifetime cfg))
(.setMinimumIdle (:min-size cfg))
(.setMaximumPoolSize (:max-size cfg))
(.setConnectionInitSql
(dm/fmt "SET statement_timeout=%; SET idle_in_transaction_session_timeout=%;"
(:statement-timeout cfg)
(:idle-in-transaction-timeout cfg)))
(.setConnectionInitSql initsql)
(.setInitializationFailTimeout -1))
;; When metrics namespace is provided