From 1e8e45232a946d55b15c82b1ac792fb6f49b730c Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Thu, 17 Oct 2019 16:28:28 +0200 Subject: [PATCH] Setup a timeout on long query --- config/database.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/database.yml b/config/database.yml index 1f4b1a8f2..6308f93bf 100644 --- a/config/database.yml +++ b/config/database.yml @@ -3,6 +3,11 @@ default: &default encoding: unicode pool: <%= ENV.fetch("DB_POOL") { 5 } %> timeout: 5000 + # sql queries will be killed after 60s + # we should reduce this number + # A bigger timeout can be set for jobs + variables: + statement_timeout: <%= ENV['PG_STATEMENT_TIMEOUT'] || 60000 %> development: <<: *default