Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add heartbeat request

  • Loading branch information...
commit 96cdbed2c5b8ec785587282dd77756e30e25b732 1 parent 6f7f56e
Ryan Daigle authored October 09, 2012
23  app/controllers/monitors_controller.rb
... ...
@@ -0,0 +1,23 @@
  1
+class MonitorsController < ApplicationController
  2
+  
  3
+  def heartbeat
  4
+    respond_to do |format|
  5
+      format.json do
  6
+        render :json => {
  7
+          'search' => test_search.any?,
  8
+          'db' => !Gist.order(:id).first.nil?,
  9
+          'cache' => !Rails.cache.exist?('monitors-heartbeat-foobar')
  10
+        }
  11
+      end
  12
+    end
  13
+  end
  14
+
  15
+  private
  16
+
  17
+  def test_search
  18
+    Gist.tire.search do
  19
+      query { string "*" }
  20
+      size 1
  21
+    end
  22
+  end
  23
+end
3  config/routes.rb
@@ -8,6 +8,9 @@
8 8
   match '/auth/github/callback', to: 'sessions#create', :via => [:post, :get], :as => :github_auth_callback
9 9
   match '/auth/failure', to: 'sessions#failure'
10 10
 
  11
+  # Monitoring
  12
+  match '/heartbeat', to: 'monitors#heartbeat', :as => :heartbeat
  13
+
11 14
   # Though this was an option at one time?
12 15
   all = [:index, :show, :new, :create, :edit, :update, :destroy]
13 16
 

0 notes on commit 96cdbed

Please sign in to comment.
Something went wrong with that request. Please try again.