Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Greenlight
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arbeitsgruppe Hardwarenahe IT-Systeme
Greenlight
Commits
b4c0b2f9
Unverified
Commit
b4c0b2f9
authored
1 year ago
by
Ahmad Farhat
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix health check destroying db connections (#5249)
parent
a73a3140
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/health_checks_controller.rb
+1
-4
1 addition, 4 deletions
app/controllers/health_checks_controller.rb
lib/tasks/configuration.rake
+1
-3
1 addition, 3 deletions
lib/tasks/configuration.rake
with
2 additions
and
7 deletions
app/controllers/health_checks_controller.rb
+
1
−
4
View file @
b4c0b2f9
...
...
@@ -37,10 +37,7 @@ class HealthChecksController < ApplicationController
private
def
check_database
ActiveRecord
::
Base
.
establish_connection
# Establishes connection
ActiveRecord
::
Base
.
connection
# Calls connection object
raise
'Unable to connect to Database'
unless
ActiveRecord
::
Base
.
connected?
raise
'Unable to connect to Database'
unless
ActiveRecord
::
Base
.
connection
.
active?
raise
'Unable to connect to Database - pending migrations'
unless
ActiveRecord
::
Migration
.
check_pending!
.
nil?
rescue
StandardError
=>
e
raise
"Unable to connect to Database -
#{
e
}
"
...
...
This diff is collapsed.
Click to expand it.
lib/tasks/configuration.rake
+
1
−
3
View file @
b4c0b2f9
...
...
@@ -32,9 +32,7 @@ namespace :configuration do
info
'Checking connection to Postgres Database:'
begin
ActiveRecord
::
Base
.
establish_connection
# Establishes connection
ActiveRecord
::
Base
.
connection
# Calls connection object
failed
(
'Unable to connect to Database'
)
unless
ActiveRecord
::
Base
.
connected?
failed
(
'Unable to connect to Database'
)
unless
ActiveRecord
::
Base
.
connection
.
active?
rescue
StandardError
=>
e
failed
(
"Unable to connect to Database -
#{
e
}
"
)
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment