Sha256: a26440475ae4c918e18d1e28969375e3cb8ea110cc0960e567070cbcf2fc9c49

Contents?: true

Size: 541 Bytes

Versions: 1

Compression:

Stored size: 541 Bytes

Contents

module Delayed
  class StatusException < Exception
  end
  class Status
    def self.ok?(overdue=15.minutes)
      job = Delayed::StatusJob.first || Delayed::StatusJob.enqueue(::StatusJob.new)
      elapsed_time = (Time.now - job.updated_at).to_i
      raise(::Delayed::StatusException, "Rails3 Status job has failed at #{job.failed_at} with message: #{job.last_error}") if job.failed?
      raise(::Delayed::StatusException, "Rails3 Status job hasn't run for #{elapsed_time} seconds") if elapsed_time > overdue
      true
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mail_manager-0.1.1 lib/delayed/status.rb