diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-02-07 00:01:56 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-02-14 20:13:54 +0800 |
commit | 521a7cafd4226a03d7f0b5d35a2370559fb345cb (patch) | |
tree | a51030de18a34f55fe29b7b0054c273ef2048ce6 /db | |
parent | 887aeefba63429b6603c75e385148a2c6be34be1 (diff) | |
download | gitlab-ce-521a7cafd4226a03d7f0b5d35a2370559fb345cb.tar.gz |
Try this way to provide database connection
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20170206040400_remove_inactive_default_email_services.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/db/post_migrate/20170206040400_remove_inactive_default_email_services.rb b/db/post_migrate/20170206040400_remove_inactive_default_email_services.rb index b107d9204d2..d69f68a13d2 100644 --- a/db/post_migrate/20170206040400_remove_inactive_default_email_services.rb +++ b/db/post_migrate/20170206040400_remove_inactive_default_email_services.rb @@ -31,13 +31,10 @@ class RemoveInactiveDefaultEmailServices < ActiveRecord::Migration end end - def with_connection + def with_connection(&block) pool = ActiveRecord::Base.establish_connection - connection = pool.connection - - yield(connection) - + pool.with_connection(&block) ensure - connection.close + pool.disconnect! end end |