Skip to content

Commit 0e5164c

Browse files
committed
Remove begin
1 parent 680af03 commit 0e5164c

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/optimizely/cmab/cmab_client.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,13 @@ def _do_fetch_with_retry(url, request_body, retry_config, timeout)
151151
last_error = nil
152152

153153
(0..retry_config.max_retries).each do |attempt|
154-
begin
155-
return _do_fetch(url, request_body, timeout)
156-
rescue => e
157-
last_error = e
158-
if attempt < retry_config.max_retries
159-
@logger.info("Retrying CMAB request (attempt: #{attempt + 1} after #{backoff} seconds)...")
160-
sleep(backoff)
161-
backoff = [backoff * (retry_config.backoff_multiplier**(attempt + 1)), retry_config.max_backoff].min
162-
end
154+
return _do_fetch(url, request_body, timeout)
155+
rescue => e
156+
last_error = e
157+
if attempt < retry_config.max_retries
158+
@logger.info("Retrying CMAB request (attempt: #{attempt + 1} after #{backoff} seconds)...")
159+
sleep(backoff)
160+
backoff = [backoff * (retry_config.backoff_multiplier**(attempt + 1)), retry_config.max_backoff].min
163161
end
164162
end
165163

0 commit comments

Comments
 (0)