Sha256: 1e6e2c47a8235c701f01625569a776194ca60522403eea0dcccf3bdb15a778ca

Contents?: true

Size: 620 Bytes

Versions: 2

Compression:

Stored size: 620 Bytes

Contents

module Importo
  class SidekiqBatchAdapter
    attr_reader :description
    attr_accessor :properties
    attr_writer :instance

    def initialize
      @instance = Sidekiq::Batch.new
    end

    delegate :description=, :bid, to: :@instance

    def on_success(job)
      @instance.on(:success, job.constantize, properties)
    end

    def add
      @instance.jobs do
        yield
      end
    end

    def finished?
      @instance.status.complete?
    end

    class << self
      def find(id)
        instance = new
        instance.instance = Sidekiq::Batch.new(id)
        instance
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
importo-3.0.17 app/adapters/importo/sidekiq_batch_adapter.rb
importo-3.0.16 app/adapters/importo/sidekiq_batch_adapter.rb