Ensure rake tasks that don't need a DB connection can be run without one
When using ActiveRecord::Base.connection.active? without a DB connection, we get a "PG::ConnectionBad: could not connect to server" error because ActiveRecord::Base.connection doesn't exist. By using ActiveRecord::Base.connected? we ensure we don't get this error if the connection is missing, which is the all point of the Gitlab::CurrentSettings#connect_to_db? method!
This commit is contained in:
parent
cd22da3ebd
commit
e6f3fe5d3b
2 changed files with 2 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
Please view this file on the master branch, on stable branches it's out of date.
|
||||
|
||||
v 8.5.0 (unreleased)
|
||||
- Ensure rake tasks that don't need a DB connection can be run without one
|
||||
- Add "visibility" flag to GET /projects api endpoint
|
||||
- Ignore binary files in code search to prevent Error 500 (Stan Hu)
|
||||
- Upgrade gitlab_git to 7.2.23 to fix commit message mentions in first branch push
|
||||
|
|
|
@ -38,7 +38,7 @@ module Gitlab
|
|||
true
|
||||
end
|
||||
|
||||
use_db && ActiveRecord::Base.connection.active? &&
|
||||
use_db && ActiveRecord::Base.connected? &&
|
||||
# The following condition is important: if a migrations adds a
|
||||
# column to the application_settings table and a validation in
|
||||
# the ApplicationSetting uses this new column we might end-up in
|
||||
|
|
Loading…
Reference in a new issue