class Freno::Throttler::Mapper::Identity
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.
“`ruby 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.
Public Class Methods
call(context)
click to toggle source
# File lib/freno/throttler/mapper.rb, line 39 def self.call(context) Array(context) end