Sha256: 7031c157cd644722eeece111d693901e0fe7e522d5c44be40d03b5e67eda46b0
Contents?: true
Size: 1010 Bytes
Versions: 2
Compression:
Stored size: 1010 Bytes
Contents
module Emilio module Schedulers module DelayedJob def self.init # Ideally this should be a recurring Job and this implementation is a # poor workaround. Must be refactored if DJ implements real recurring jobs: # https://github.com/collectiveidea/delayed_job/wiki/FEATURE:-Adding-Recurring-Job-Support-to-Delayed_Job Delayed::Job.enqueue ScheduleJob.new, :run_at => Time.now + Emilio.run_every end class ScheduleJob def perform unless Emilio::Schedulers.last_check_at.nil? || ( Time.now > Emilio::Schedulers.last_check_at + Emilio.run_every * 0.9 ) # Break here to avoid two chains of recurring jobs. Please # refactor me! We need your recurring jobs DJ! return end Emilio::Checker.check_emails Emilio::Schedulers.last_check_at = Time.now Delayed::Job.enqueue ScheduleJob.new, :run_at => Time.now + Emilio.run_every end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
emilio-0.1.1 | lib/emilio/schedulers/delayed_job/scheduler.rb |
emilio-0.1.0 | lib/emilio/schedulers/delayed_job/scheduler.rb |