Class: Firehose::Rack::Ping::PingCheck
- Inherits:
-
Object
- Object
- Firehose::Rack::Ping::PingCheck
- Includes:
- Helpers
- Defined in:
- lib/firehose/rack/ping.rb
Overview
Encapsulate this in a class so we aren’t passing a bunch of variables around
Constant Summary collapse
- TEST_VALUE =
'Firehose Healthcheck Test Value'
- SECONDS_TO_EXPIRE =
60
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#redis ⇒ Object
readonly
Returns the value of attribute redis.
-
#req ⇒ Object
readonly
Returns the value of attribute req.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(env, redis = nil) ⇒ PingCheck
constructor
A new instance of PingCheck.
Methods included from Helpers
Constructor Details
#initialize(env, redis = nil) ⇒ PingCheck
Returns a new instance of PingCheck.
33 34 35 36 37 38 |
# File 'lib/firehose/rack/ping.rb', line 33 def initialize(env, redis=nil) @redis = redis || self.class.redis @env = env @req = env['parsed_request'] ||= ::Rack::Request.new(env) @key = "/firehose/ping/#{Time.now.to_i}/#{rand}" end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
24 25 26 |
# File 'lib/firehose/rack/ping.rb', line 24 def env @env end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
24 25 26 |
# File 'lib/firehose/rack/ping.rb', line 24 def key @key end |
#redis ⇒ Object (readonly)
Returns the value of attribute redis.
24 25 26 |
# File 'lib/firehose/rack/ping.rb', line 24 def redis @redis end |
#req ⇒ Object (readonly)
Returns the value of attribute req.
24 25 26 |
# File 'lib/firehose/rack/ping.rb', line 24 def req @req end |
Class Method Details
Instance Method Details
#call ⇒ Object
40 41 42 43 |
# File 'lib/firehose/rack/ping.rb', line 40 def call log req, 'started' test_redis end |