Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STL-715: Fixing read would block error #1993

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
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
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.gd_logger.warn error_message
fail e
end
end

attr_reader :request_params
Expand Down