Class: Freno::Throttler::Mapper::Identity

Inherits:
Object
  • Object
show all
Defined in:
lib/freno/throttler/mapper.rb

Overview

The Identity mapper is the one used by default in the Throttler.

It works by informing the throttler to check exact same stores that it receives as context, without any translation.

Let's use the following throttler, which uses Mapper::Identity implicitly.

throttler = Throttler.new(client: freno_client, app: :my_app)
data.find_in_batches do |batch|
  throttler.throttle([:mysqla, :mysqlb]) do
    update(batch)
  end
end

Before each call to update(batch) the throttler will call freno to check the health of mysqla and mysqlb. And sleep if any of them is not ok.

Class Method Summary collapse

Class Method Details

.call(context) ⇒ Object



39
40
41
# File 'lib/freno/throttler/mapper.rb', line 39

def self.call(context)
  Array(context)
end