From 4caf06acdc119b60b4fd2af13c9e2f4e93d46120 Mon Sep 17 00:00:00 2001 From: Tim Yiu Date: Wed, 13 Sep 2023 11:43:21 -0700 Subject: [PATCH] fix: RemoteEvaluationClient variant fetch timeout --- 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