Skip to content

Commit

Permalink
fix: RemoteEvaluationClient variant fetch timeout (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyiuhc authored Sep 13, 2023
1 parent 01d5bf9 commit b4bf159
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/experiment/remote/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def retry_fetch(user)
delay_millis = @config.fetch_retry_backoff_min_millis
err = nil
@config.fetch_retries.times do
sleep(delay_millis / 1000.0)
sleep(delay_millis.to_f / 1000.0)
begin
return do_fetch(user, @config.fetch_retry_timeout_millis)
rescue StandardError => e
Expand All @@ -98,7 +98,7 @@ def do_fetch(user, timeout_millis)
'Authorization' => "Api-Key #{@api_key}",
'Content-Type' => 'application/json;charset=utf-8'
}
read_timeout = timeout_millis / 1000 if (timeout_millis / 1000) > 0
read_timeout = timeout_millis.to_f / 1000 if (timeout_millis.to_f / 1000) > 0
http = PersistentHttpClient.get(@uri, { read_timeout: read_timeout }, @api_key)
request = Net::HTTP::Post.new(@uri, headers)
request.body = user_context.to_json
Expand Down

0 comments on commit b4bf159

Please sign in to comment.