Sha256: 5f00c944a1a42203a50ef1c2e93e55c58ee91a7f7a1a804c493407f9a9d292a6
Contents?: true
Size: 933 Bytes
Versions: 16
Compression:
Stored size: 933 Bytes
Contents
require 'lhm/throttler/time' require 'lhm/throttler/slave_lag' require 'lhm/throttler/threads_running' module Lhm module Throttler CLASSES = { :time_throttler => Throttler::Time, :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
16 entries across 16 versions & 2 rubygems