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

fix: RemoteEvaluationClient fetch() timeout #51

Merged
merged 1 commit into from
Sep 13, 2023
Merged
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
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