batch_request_with_retry

in lib/fluent/plugin/kinesis_helper/api.rb [77:93]


      def batch_request_with_retry(batch, retry_count=0, backoff: nil)
        backoff ||= Backoff.new
        res = batch_request(batch)
        if failed_count(res) > 0
          failed_records = collect_failed_records(batch, res)
          if retry_count < @retries_on_batch_request
            backoff.reset if @reset_backoff_if_success and any_records_shipped?(res)
            sleep(backoff.next)
            log.warn(truncate 'Retrying to request batch. Retry count: %d, Retry records: %d' % [retry_count, failed_records.size])
            retry_batch = failed_records.map{|r| r[:original] }
            batch_request_with_retry(retry_batch, retry_count + 1, backoff: backoff)
          else
            give_up_retries(failed_records)
          end
        end
      end