Sha256: 7fe2ee6fe11d9bcb65bb07f8b5cc8478bde49c04b597ca2cd7c976225bec2c87

Contents?: true

Size: 479 Bytes

Versions: 1

Compression:

Stored size: 479 Bytes

Contents

module Sidejobs
  class Processor
    include Loggable

    def process
      Sidejobs.queue.fetch.each do |job|
        job.update status: 'processing', processed_at: Time.now, attempts: job.attempts+1
        begin
          ActiveJob::Base.execute job.data
          job.update status: 'complete', completed_at: Time.now
        rescue => exception
          job.update status: 'failing', failed_at: Time.now, error: exception.message
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sidejobs-5.1.0 lib/sidejobs/processor.rb