Module: Etl::Integrations::Core::RateLimiter

Instance Method Summary collapse

Instance Method Details

#write(sync_config, records, action = "insert") ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/etl/integrations/core/rate_limiter.rb', line 6

def write(sync_config, records, action = "insert")
  stream = sync_config.stream

  @queue ||= Limiter::RateQueue.new(stream.request_rate_limit, interval: stream.rate_limit_unit_seconds) do
    Integrations::Service.logger.info("Hit the limit for stream: #{stream.name}, waiting")
  end

  @queue.shift

  super(sync_config, records, action)
end