Sha256: 51e4cb1f2d90f536bbfdfa88d9bdf426ce6a0302c0aadbb031fed1fa0b9347f4
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
require 'lhm/throttler/backoff_reduction' require 'lhm/throttler/time' require 'lhm/throttler/replica_lag' require 'lhm/throttler/slave_lag' require 'lhm/throttler/threads_running' module Lhm module Throttler CLASSES = { :time_throttler => Throttler::Time, :replica_lag_throttler => Throttler::ReplicaLag, :slave_lag_throttler => Throttler::SlaveLag, :threads_running_throttler => Throttler::ThreadsRunning } def throttler @throttler ||= Throttler::Time.new end def setup_throttler(type, options = {}) @throttler = Factory.create_throttler(type, options) end class Factory def self.create_throttler(type, options = {}) case type when Lhm::Command type when Symbol CLASSES[type].new(options) when String CLASSES[type.to_sym].new(options) when Class type.new(options) else raise ArgumentError, 'type argument must be a Symbol, String or Class' end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lhm-shopify-4.5.0 | lib/lhm/throttler.rb |
lhm-shopify-4.4.2 | lib/lhm/throttler.rb |
lhm-shopify-4.4.1 | lib/lhm/throttler.rb |