mirror of
https://github.com/penpot/penpot.git
synced 2025-05-07 21:25:54 +02:00
✨ Update default timeouts on db namespace.
This commit is contained in:
parent
925058467f
commit
c55f740978
2 changed files with 10 additions and 9 deletions
|
@ -54,7 +54,8 @@
|
||||||
(s/def ::migrations map?)
|
(s/def ::migrations map?)
|
||||||
|
|
||||||
(defmethod ig/pre-init-spec ::pool [_]
|
(defmethod ig/pre-init-spec ::pool [_]
|
||||||
(s/keys :req-un [::uri ::name ::min-pool-size ::max-pool-size ::migrations ::mtx/metrics]))
|
(s/keys :req-un [::uri ::name ::min-pool-size ::max-pool-size ::mtx/metrics]
|
||||||
|
:opt-un [::migrations]))
|
||||||
|
|
||||||
(defmethod ig/init-key ::pool
|
(defmethod ig/init-key ::pool
|
||||||
[_ {:keys [migrations metrics] :as cfg}]
|
[_ {:keys [migrations metrics] :as cfg}]
|
||||||
|
@ -89,8 +90,8 @@
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(def initsql
|
(def initsql
|
||||||
(str "SET statement_timeout = 120000;\n"
|
(str "SET statement_timeout = 200000;\n"
|
||||||
"SET idle_in_transaction_session_timeout = 120000;"))
|
"SET idle_in_transaction_session_timeout = 200000;"))
|
||||||
|
|
||||||
(defn- create-datasource-config
|
(defn- create-datasource-config
|
||||||
[{:keys [metrics] :as cfg}]
|
[{:keys [metrics] :as cfg}]
|
||||||
|
@ -104,10 +105,10 @@
|
||||||
(.setPoolName (d/name (:name cfg)))
|
(.setPoolName (d/name (:name cfg)))
|
||||||
(.setAutoCommit true)
|
(.setAutoCommit true)
|
||||||
(.setReadOnly false)
|
(.setReadOnly false)
|
||||||
(.setConnectionTimeout 8000) ;; 8seg
|
(.setConnectionTimeout 10000) ;; 10seg
|
||||||
(.setValidationTimeout 8000) ;; 8seg
|
(.setValidationTimeout 10000) ;; 10seg
|
||||||
(.setIdleTimeout 120000) ;; 2min
|
(.setIdleTimeout 120000) ;; 2min
|
||||||
(.setMaxLifetime 1800000) ;; 30min
|
(.setMaxLifetime 1800000) ;; 30min
|
||||||
(.setMinimumIdle (:min-pool-size cfg 0))
|
(.setMinimumIdle (:min-pool-size cfg 0))
|
||||||
(.setMaximumPoolSize (:max-pool-size cfg 30))
|
(.setMaximumPoolSize (:max-pool-size cfg 30))
|
||||||
(.setMetricsTrackerFactory mtf)
|
(.setMetricsTrackerFactory mtf)
|
||||||
|
@ -127,7 +128,7 @@
|
||||||
[pool]
|
[pool]
|
||||||
(.isClosed ^HikariDataSource pool))
|
(.isClosed ^HikariDataSource pool))
|
||||||
|
|
||||||
(defn- create-pool
|
(defn create-pool
|
||||||
[cfg]
|
[cfg]
|
||||||
(let [dsc (create-datasource-config cfg)]
|
(let [dsc (create-datasource-config cfg)]
|
||||||
(jdbc-dt/read-as-instant)
|
(jdbc-dt/read-as-instant)
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
:migrations (ig/ref :app.migrations/all)
|
:migrations (ig/ref :app.migrations/all)
|
||||||
:name :main
|
:name :main
|
||||||
:min-pool-size 0
|
:min-pool-size 0
|
||||||
:max-pool-size 20}
|
:max-pool-size 30}
|
||||||
|
|
||||||
:app.metrics/metrics
|
:app.metrics/metrics
|
||||||
{:definitions
|
{:definitions
|
||||||
|
|
Loading…
Add table
Reference in a new issue