From b4bf159f9d51cb6f47f538ab6b047d29010cbca9 Mon Sep 17 00:00:00 2001 From: tyiuhc <137842098+tyiuhc@users.noreply.github.com> Date: Wed, 13 Sep 2023 12:01:46 -0700 Subject: [PATCH] fix: RemoteEvaluationClient variant fetch timeout (#51) --- lib/experiment/remote/client.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/experiment/remote/client.rb b/lib/experiment/remote/client.rb index 91e93f2..baec041 100644 --- a/lib/experiment/remote/client.rb +++ b/lib/experiment/remote/client.rb @@ -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 @@ -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