class QPush::Server::Job
Public Class Methods
new(options)
click to toggle source
Calls superclass method
QPush::Base::Job::new
# File lib/qpush/server/jobs.rb, line 27 def initialize(options) super end
Public Instance Methods
cron_at()
click to toggle source
# File lib/qpush/server/jobs.rb, line 61 def cron_at CronParser.new(@cron).next(Time.now).to_i rescue => e raise ServerError, e.message end
cron_job?()
click to toggle source
# File lib/qpush/server/jobs.rb, line 53 def cron_job? @start_at < Time.now.to_i && !@cron.empty? end
dead_job?()
click to toggle source
# File lib/qpush/server/jobs.rb, line 57 def dead_job? @total_fail >= @retry_max end
delay_job?()
click to toggle source
# File lib/qpush/server/jobs.rb, line 49 def delay_job? (@start_at > Time.now.to_i && @cron.empty?) || cron_job? end
delay_until()
click to toggle source
# File lib/qpush/server/jobs.rb, line 67 def delay_until @cron.empty? ? @start_at : cron_at end
mark_failed()
click to toggle source
# File lib/qpush/server/jobs.rb, line 36 def mark_failed @failed = true @total_fail += 1 end
mark_success()
click to toggle source
# File lib/qpush/server/jobs.rb, line 31 def mark_success @failed = false @total_success += 1 end
perform_job?()
click to toggle source
# File lib/qpush/server/jobs.rb, line 45 def perform_job? @start_at < Time.now.to_i && @cron.empty? end
retry_at()
click to toggle source
# File lib/qpush/server/jobs.rb, line 71 def retry_at Time.now.to_i + ((@total_fail**4) + 15 + (rand(30) * (@total_fail + 1))) end
retry_job?()
click to toggle source
# File lib/qpush/server/jobs.rb, line 41 def retry_job? @retry_max > @total_fail end