batch_request_with_retry

in lib/fluent/plugin/kinesis_helper/api.rb [91:110]


          def batch_request_with_retry(batch, retry_count=0, backoff: nil, &block)
            backoff ||= Backoff.new
            res = yield(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)
                wait_second = backoff.next
                msg = 'Retrying to request batch. Retry count: %3d, Retry records: %3d, Wait seconds %3.2f' % [retry_count+1, failed_records.size, wait_second]
                log.warn(truncate msg)
                
                increment_num_errors if @monitor_num_of_batch_request_retries
                reliable_sleep(wait_second)
                batch_request_with_retry(retry_records(failed_records), retry_count+1, backoff: backoff, &block)
              else
                give_up_retries(failed_records)
              end
            end
          end