Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/fluent/plugin/bigquery/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Error < StandardError
RETRYABLE_INSERT_ERRORS_REASON = %w(timeout backendError internalError rateLimitExceeded).freeze
RETRYABLE_STATUS_CODE = [500, 502, 503, 504]
REGION_NOT_WRITABLE_MESSAGE = -"is not writable in the region"
SSL_UNEXPECTED_EOF_MESSAGE = -"SSL_read: unexpected eof while reading"

class << self
# @param e [Google::Apis::Error]
Expand All @@ -20,7 +21,7 @@ def wrap(e, message = nil)

# @param e [Google::Apis::Error]
def retryable_error?(e)
retryable_server_error?(e) || retryable_region_not_writable?(e)
retryable_server_error?(e) || retryable_region_not_writable?(e) || retryable_ssl_unexpected_eof?(e)
end

def retryable_server_error?(e)
Expand All @@ -39,6 +40,10 @@ def retryable_region_not_writable?(e)
e.is_a?(Google::Apis::ClientError) && e.status_code == 400 && e.message.include?(REGION_NOT_WRITABLE_MESSAGE)
end

def retryable_ssl_unexpected_eof?(e)
e.message.include?(SSL_UNEXPECTED_EOF_MESSAGE)
end

# Guard for instantiation
private :new
def inherited(subclass)
Expand Down