Class: Arask::RunJobs

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/arask/run_jobs.rb

Instance Method Summary collapse

Instance Method Details

#performObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/arask/run_jobs.rb', line 5

def perform
  begin
    AraskJob.transaction do
      AraskJob.where('execute_at < ?', DateTime.now).lock.each do |job|
        job.run
      end
    end
  rescue
  end
  Arask.queue_self
end