Sha256: 82a0542896dcac784dc0da46a4880367c7253dcea73d23b335a1031d2c6e2fe5

Contents?: true

Size: 578 Bytes

Versions: 7

Compression:

Stored size: 578 Bytes

Contents

require "active_support/concern"

module DistributeReads
  module JobMethods
    extend ActiveSupport::Concern

    included do
      before_perform do
        if DistributeReads.by_default
          if DistributeReads.makara3?
            Makara::Context.set_current(Makara::Context.generate)
          else
            Makara::Context.release_all
          end
        end
      end
    end

    class_methods do
      def distribute_reads(*args)
        around_perform do |_job, block|
          distribute_reads(*args) { block.call }
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
distribute_reads-0.3.5 lib/distribute_reads/job_methods.rb
distribute_reads-0.3.4 lib/distribute_reads/job_methods.rb
distribute_reads-0.3.3 lib/distribute_reads/job_methods.rb
distribute_reads-0.3.2 lib/distribute_reads/job_methods.rb
distribute_reads-0.3.1 lib/distribute_reads/job_methods.rb
distribute_reads-0.3.0 lib/distribute_reads/job_methods.rb
distribute_reads-0.2.4 lib/distribute_reads/job_methods.rb