datacite/poodle

View on GitHub
app/models/heartbeat.rb

Summary

Maintainability
A
0 mins
Test Coverage
D
63%
require "timeout"

class Heartbeat
  attr_reader :string, :status

  def initialize
    @string = "OK"
    @status = 200

    # if memcached_up?
    #   @string = "OK"
    #   @status = 200
    # else
    #   @string = "failed"
    #   @status = 500
    # end
  end

  def memcached_up?
    memcached_client = Dalli::Client.new(ENV['MEMCACHE_SERVERS'])
    memcached_client.alive!
    true
  rescue
    false
  end
end