Sha256: bf49ba0369b734360d6967716e512f69e6bf9ff3ca00858eef8f887b6a4b470d

Contents?: true

Size: 446 Bytes

Versions: 3

Compression:

Stored size: 446 Bytes

Contents

require "active_support/concern"

module DistributeReads
  module JobMethods
    extend ActiveSupport::Concern

    included do
      before_perform do
        Makara::Context.set_current(Makara::Context.generate) if DistributeReads.by_default
      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

3 entries across 3 versions & 1 rubygems

Version Path
distribute_reads-0.2.2 lib/distribute_reads/job_methods.rb
distribute_reads-0.2.1 lib/distribute_reads/job_methods.rb
distribute_reads-0.2.0 lib/distribute_reads/job_methods.rb