lib/fluent/plugin/bigquery/errors.rb in fluent-plugin-bigquery-0.4.0 vs lib/fluent/plugin/bigquery/errors.rb in fluent-plugin-bigquery-0.4.1

- old
+ new

@@ -1,10 +1,11 @@ module Fluent module BigQuery # @abstract class Error < StandardError RETRYABLE_ERROR_REASON = %w(backendError internalError rateLimitExceeded tableUnavailable).freeze + RETRYABLE_INSERT_ERRORS_REASON = %w(timeout).freeze RETRYABLE_STATUS_CODE = [500, 503] class << self def wrap(google_api_error, message = nil, force_unretryable: false) e = google_api_error @@ -25,9 +26,13 @@ (e.is_a?(Google::Apis::ServerError) && RETRYABLE_STATUS_CODE.include?(e.status_code)) end def retryable_error_reason?(reason) RETRYABLE_ERROR_REASON.include?(reason) + end + + def retryable_insert_errors_reason?(reason) + RETRYABLE_INSERT_ERRORS_REASON.include?(reason) end # Guard for instantiation private :new def inherited(subclass)