Sha256: e584926adebd747faf0a700349aec2d5227c48747073afc4fd7a968b053fdd93
Contents?: true
Size: 913 Bytes
Versions: 3
Compression:
Stored size: 913 Bytes
Contents
module StatusCat module Checkers class DelayedJob < Base include ActionView::Helpers::DateHelper def initialize if !defined?( ::Delayed ) @status = 'delayed_job gem not installed' else @status = fail_on_exception do sql = 'select count(*) from delayed_jobs' result = ::ActiveRecord::Base.connection.execute( sql ).first @value = result.is_a?( Hash ) ? result[ 'count' ] : result[ 0 ] expires = 1.day.ago sql = "select count(*) from delayed_jobs where created_at < '#{expires.to_s( :db )}'" result = ::ActiveRecord::Base.connection.execute( sql ).first value = result.is_a?( Hash ) ? result[ 'count' ] : result[ 0 ] ( value.to_i == 0 ) ? nil : "#{value} jobs more than #{time_ago_in_words( expires )} old" end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
status_cat-0.1.0 | lib/status_cat/checkers/delayed_job.rb |
status_cat-0.0.9 | lib/status_cat/checkers/delayed_job.rb |
status_cat-0.0.8 | lib/status_cat/checkers/delayed_job.rb |