Skip to content

Commit cccbf08

Browse files
authored
Merge pull request #222 from murakami-ta/retry-on-ssh-error
Retry on SSL EOF error
2 parents c12fc3c + a6ec687 commit cccbf08

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/fluent/plugin/bigquery/errors.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class Error < StandardError
66
RETRYABLE_INSERT_ERRORS_REASON = %w(timeout backendError internalError rateLimitExceeded).freeze
77
RETRYABLE_STATUS_CODE = [500, 502, 503, 504]
88
REGION_NOT_WRITABLE_MESSAGE = -"is not writable in the region"
9+
SSL_UNEXPECTED_EOF_MESSAGE = -"SSL_read: unexpected eof while reading"
910

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

2122
# @param e [Google::Apis::Error]
2223
def retryable_error?(e)
23-
retryable_server_error?(e) || retryable_region_not_writable?(e)
24+
retryable_server_error?(e) || retryable_region_not_writable?(e) || retryable_ssl_unexpected_eof?(e)
2425
end
2526

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

43+
def retryable_ssl_unexpected_eof?(e)
44+
e.message.include?(SSL_UNEXPECTED_EOF_MESSAGE)
45+
end
46+
4247
# Guard for instantiation
4348
private :new
4449
def inherited(subclass)

0 commit comments

Comments
 (0)