FIX: Set PG `connect_timeout` to 5 seconds.

* 30 seconds is alittle too long.
This commit is contained in:
Guo Xiang Tan 2017-10-17 12:32:41 +08:00
parent 2db66072d7
commit b54eb8f53c
2 changed files with 5 additions and 2 deletions

View File

@ -92,7 +92,7 @@ class GlobalSetting
def self.database_config def self.database_config
hash = { "adapter" => "postgresql" } hash = { "adapter" => "postgresql" }
%w{pool timeout socket host port username password replica_host replica_port}.each do |s| %w{pool connect_timeout timeout socket host port username password replica_host replica_port}.each do |s|
if val = self.send("db_#{s}") if val = self.send("db_#{s}")
hash[s] = val hash[s] = val
end end

View File

@ -17,9 +17,12 @@
# connection pool size, sidekiq is set to 5, allowing an extra 3 for bg threads # connection pool size, sidekiq is set to 5, allowing an extra 3 for bg threads
db_pool = 8 db_pool = 8
# database timeout in milliseconds # ActiveRecord connection pool timeout in milliseconds
db_timeout = 5000 db_timeout = 5000
# Database connection timoue in seconds
db_connect_timeout = 5
# socket file used to access db # socket file used to access db
db_socket = db_socket =