Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Always throw exception on heartbeat failure

  • Loading branch information...
commit ae1b42b484971c5aa07a56fdadc84f4b021deb1a 1 parent 11e2dab
@rwdaigle authored
Showing with 15 additions and 3 deletions.
  1. +15 −3 app/controllers/monitors_controller.rb
View
18 app/controllers/monitors_controller.rb
@@ -4,8 +4,8 @@ def heartbeat
respond_to do |format|
format.json do
render :json => {
- 'search' => test_search.any?,
- 'db' => !Gist.order(:id).first.nil?,
+ 'search' => test_search,
+ 'db' => test_db,
'cache' => !Rails.cache.exist?('monitors-heartbeat-foobar')
}
end
@@ -15,9 +15,21 @@ def heartbeat
private
def test_search
- Gist.tire.search do
+ results = Gist.tire.search do
query { string "*" }
size 1
end
+ raise "SearchCheckFail" unless results.any?
+ true
+ end
+
+ def test_db
+ raise "DatabaseCheckFail" if Gist.order(:id).first.nil?
+ true
+ end
+
+ def test_cache
+ raise "CacheCheckFail" unless !Rails.cache.exist?('monitors-heartbeat-foobar')
+ true
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.