Sha256: 252624c4f2d64f4922e73eb26eaa0f27b6a1775ed79f38ec5be73f6ac99556e6
Contents?: true
Size: 459 Bytes
Versions: 1
Compression:
Stored size: 459 Bytes
Contents
module DistributeReads module GlobalMethods def distribute_reads(max_lag: nil) if max_lag && DistributeReads.lag > max_lag raise DistributeReads::TooMuchLag, "Replica lag over #{max_lag} seconds" end previous_value = Thread.current[:distribute_reads] begin Thread.current[:distribute_reads] = true yield ensure Thread.current[:distribute_reads] = previous_value end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
distribute_reads-0.1.1 | lib/distribute_reads/global_methods.rb |