Skip to content

Commit

Permalink
Check database and redis connections during health check
Browse files Browse the repository at this point in the history
  • Loading branch information
akadusei committed Jun 22, 2024
1 parent 52a1b17 commit f7bc5e2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/actions/api__private/health/show.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
# skip :require_logged_out

# get "/up" do
# verify_database_connection
# verify_redis_connection

# head :no_content
# end

# private def verify_database_connection
# Db::VerifyConnection.new(quiet: LuckyEnv.production?).run_task
# end

# private def verify_redis_connection
# Mel.redis.run({"PING"})
# end
# end
11 changes: 11 additions & 0 deletions src/actions/health/show.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ class Health::Show < BrowserAction
skip :require_logged_out

get "/up" do
verify_database_connection
verify_redis_connection

head :no_content
end

private def verify_database_connection
Db::VerifyConnection.new(quiet: LuckyEnv.production?).run_task
end

private def verify_redis_connection
Mel.redis.run({"PING"})
end
end

0 comments on commit f7bc5e2

Please sign in to comment.