Skip to content

Commit

Permalink
STL-715: Fixing read would block error
Browse files Browse the repository at this point in the history
  • Loading branch information
hung-nguyen-hoang committed Oct 11, 2024
1 parent e3aac26 commit 3646521
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.73
3.7.74
16 changes: 11 additions & 5 deletions lib/gooddata/rest/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def generate_string(length = ID_LENGTH)

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

retry_exception = opts[:on]
retries = opts[:tries]
Expand All @@ -114,21 +114,27 @@ def retryable(options = {}, &_block)
if (retries -= 1) > 0
retry
else
fail e
process_retry_error(e, retry_time)
end
rescue RestClient::TooManyRequests, RestClient::ServiceUnavailable, *retry_exception => e
GoodData.logger.warn "#{e.message}, retrying in #{retry_time} seconds"
sleep retry_time
retry_time *= RETRY_TIME_COEFFICIENT
# 10 requests with 1.5 coefficent should take ~ 3 mins to finish
# Total 10 retry requests with 1.5 coefficent should take ~ 2 mins to finish
if (retries -= 1) > 0
retry
else
fail e
process_retry_error(e, retry_time)
end
end
yield
end

def process_retry_error(e, retry_time)
error_message = "#{e.message}, retrying in #{retry_time} seconds"
GoodData.logger.warn error_message
GoodData.rest_logger.warn error_message
fail e
end
end

attr_reader :request_params
Expand Down

0 comments on commit 3646521

Please sign in to comment.