lib/pgbouncerhero/connection.rb in pgbouncerhero-0.1.1 vs lib/pgbouncerhero/connection.rb in pgbouncerhero-1.0.0
- old
+ new
@@ -5,10 +5,11 @@
@host = host
@port = port
@user = user
@password = password
@dbname = dbname
+ @timeout = ENV["PGBOUNCERHERO_TIMEOUT"] || 5
end
def connection
@connection ||= begin
begin
@@ -16,13 +17,13 @@
host: @host,
port: @port,
user: @user,
password: @password,
dbname: @dbname,
- connect_timeout: 5
+ connect_timeout: @timeout
)
- rescue => e
- Rails.logger.info(e)
+ rescue Exception => e
+ Rails.logger.error("[PGBouncerHero] Host:#{@host} | Database Name:#{@dbname} | Timeout: #{@timeout}s => #{e}")
nil
end
end
end