File tree Expand file tree Collapse file tree 4 files changed +11
-9
lines changed
Expand file tree Collapse file tree 4 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,10 @@ Gem::Specification.new do |spec|
2929 spec . add_runtime_dependency "faraday-http-cache" , "~> 1.3.0"
3030 spec . add_runtime_dependency "thread_safe" , "~> 0.3"
3131 spec . add_runtime_dependency "net-http-persistent" , "~> 2.9"
32- spec . add_runtime_dependency "concurrent-ruby" , "~> 1.0.0 "
32+ spec . add_runtime_dependency "concurrent-ruby" , "~> 1.0.4 "
3333 spec . add_runtime_dependency "hashdiff" , "~> 0.2"
34- spec . add_runtime_dependency "ld-celluloid-eventsource" , "~> 0.5"
34+ spec . add_runtime_dependency "ld-celluloid-eventsource" , "~> 0.8.1"
35+ spec . add_runtime_dependency "nio4r" , "~> 1.1" # for maximum ruby version compatibility.
36+
3537 spec . add_runtime_dependency "waitutil" , "0.2"
3638end
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ class Config
3737 # @option opts [Boolean] :offline (false) Whether the client should be initialized in
3838 # offline mode. In offline mode, default values are returned for all flags and no
3939 # remote network requests are made.
40- # @option opts [Float] :poll_interval (30 ) The number of seconds between polls for flag updates
40+ # @option opts [Float] :poll_interval (1 ) The number of seconds between polls for flag updates
4141 # if streaming is off.
4242 # @option opts [Boolean] :stream (true) Whether or not the streaming API should be used to receive flag updates.
4343 #
Original file line number Diff line number Diff line change @@ -24,13 +24,16 @@ def request_flag(key)
2424 end
2525
2626 def make_request ( path )
27- res = @client . get ( @config . base_uri + path ) do |req |
27+ uri = @config . base_uri + path
28+ res = @client . get ( uri ) do |req |
2829 req . headers [ "Authorization" ] = @sdk_key
2930 req . headers [ "User-Agent" ] = "RubyClient/" + LaunchDarkly ::VERSION
3031 req . options . timeout = @config . read_timeout
3132 req . options . open_timeout = @config . connect_timeout
3233 end
3334
35+ @config . logger . debug ( "[LDClient] Got response from uri: #{ uri } \n \t status code: #{ res . status } \n \t headers: #{ res . headers } \n \t body: #{ res . body } " )
36+
3437 if res . status == 401
3538 @config . logger . error ( "[LDClient] Invalid SDK key" )
3639 return nil
Original file line number Diff line number Diff line change 11require "concurrent/atomics"
22require "json"
3- require "celluloid /eventsource"
3+ require "ld_celluloid_eventsource /eventsource"
44
55module LaunchDarkly
66 PUT = :put
@@ -40,14 +40,11 @@ def start
4040 conn . on ( DELETE ) { |message | process_message ( message , DELETE ) }
4141 conn . on ( INDIRECT_PUT ) { |message | process_message ( message , INDIRECT_PUT ) }
4242 conn . on ( INDIRECT_PATCH ) { |message | process_message ( message , INDIRECT_PATCH ) }
43- conn . on_error do |message |
44- @config . logger . error ( "[LDClient] Error connecting to stream. Status code: #{ message [ :status_code ] } " )
45- end
4643 end
4744 end
4845
4946 def process_message ( message , method )
50- @config . logger . debug ( "[LDClient] Stream received #{ method } message" )
47+ @config . logger . debug ( "[LDClient] Stream received #{ method } message: #{ message . data } " )
5148 if method == PUT
5249 message = JSON . parse ( message . data , symbolize_names : true )
5350 @store . init ( message )
You can’t perform that action at this time.
0 commit comments