Skip to content

Commit 8459d03

Browse files
Merge pull request #1993 from gooddata/STL-715
STL-715: Fixing read would block error
2 parents e3aac26 + a994028 commit 8459d03

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.7.73
1+
3.7.74

lib/gooddata/rest/connection.rb

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def generate_string(length = ID_LENGTH)
9494

9595
# Retry block if exception thrown
9696
def retryable(options = {}, &_block)
97-
opts = { :tries => 12, :on => RETRYABLE_ERRORS }.merge(options)
97+
opts = { :tries => 17, :on => RETRYABLE_ERRORS }.merge(options)
9898

9999
retry_exception = opts[:on]
100100
retries = opts[:tries]
@@ -114,21 +114,27 @@ def retryable(options = {}, &_block)
114114
if (retries -= 1) > 0
115115
retry
116116
else
117-
fail e
117+
process_retry_error(e, retry_time)
118118
end
119119
rescue RestClient::TooManyRequests, RestClient::ServiceUnavailable, *retry_exception => e
120-
GoodData.logger.warn "#{e.message}, retrying in #{retry_time} seconds"
121120
sleep retry_time
122121
retry_time *= RETRY_TIME_COEFFICIENT
123-
# 10 requests with 1.5 coefficent should take ~ 3 mins to finish
122+
# Total 10 retry requests with 1.5 coefficent should take ~ 2 mins to finish
124123
if (retries -= 1) > 0
125124
retry
126125
else
127-
fail e
126+
process_retry_error(e, retry_time)
128127
end
129128
end
130129
yield
131130
end
131+
132+
def process_retry_error(e, retry_time)
133+
error_message = "#{e.message}, retrying in #{retry_time} seconds"
134+
GoodData.logger.warn error_message
135+
GoodData.gd_logger.warn error_message
136+
fail e
137+
end
132138
end
133139

134140
attr_reader :request_params

0 commit comments

Comments
 (0)