diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-08 23:12:07 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-08 23:12:07 -0800 |
commit | e4dc3035ce881baf371a8445391c9ca393406290 (patch) | |
tree | 7b54662eaa631e0d51fa070f7aa4d6a920d97f3b /activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | |
parent | f99b254e4e382ddd2cc86acff9ed80663b8c7817 (diff) | |
parent | 02a3c0e771b3e09173412f93d8699d4825a366d6 (diff) | |
download | rails-e4dc3035ce881baf371a8445391c9ca393406290.tar.gz rails-e4dc3035ce881baf371a8445391c9ca393406290.tar.bz2 rails-e4dc3035ce881baf371a8445391c9ca393406290.zip |
Merge pull request #13981 from Fortisque/kevin/postgresql_reaper_threadsafe
Reaper has access to threadsafe active? call
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 9618ba4087..36c7462419 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -586,11 +586,16 @@ module ActiveRecord # Is this connection alive and ready for queries? def active? - @connection.connect_poll != PG::PGRES_POLLING_FAILED + @connection.query 'SELECT 1' + true rescue PGError false end + def active_threadsafe? + @connection.connect_poll != PG::PGRES_POLLING_FAILED + end + # Close then reopen the connection. def reconnect! super |