Sha256: 2f785eaf8092dae9aef9ea29214a4b0d4cebcdb93479ae2bfec50affd3e24b6e

Contents?: true

Size: 443 Bytes

Versions: 2

Compression:

Stored size: 443 Bytes

Contents

require "active_support/concern"

module DistributeReads
  module JobMethods
    extend ActiveSupport::Concern

    included do
      before_perform do
        if DistributeReads.by_default
          Makara::Context.release_all
        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

2 entries across 2 versions & 1 rubygems

Version Path
distribute_reads-0.5.0 lib/distribute_reads/job_methods.rb
distribute_reads-0.4.0 lib/distribute_reads/job_methods.rb