Sha256: d04b33fe7da049d01240d12ea7f11805639ebdb5e6611aa37390f2eb4ebaa910

Contents?: true

Size: 577 Bytes

Versions: 1

Compression:

Stored size: 577 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

1 entries across 1 versions & 1 rubygems

Version Path
distribute_reads-0.2.3 lib/distribute_reads/job_methods.rb