Sha256: ca9dceded2ca87780e78e9d36073ec0b1f0eef22dff9f0347c44e85835cf5321

Contents?: true

Size: 436 Bytes

Versions: 1

Compression:

Stored size: 436 Bytes

Contents

module Sidejobs
  class Processor
    include Loggable

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

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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