Skip to content

Commit

Permalink
fix: Log warning if provided high client init timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
keelerm84 committed May 8, 2024
1 parent 629ecb5 commit f7ba485
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lib/ldclient-rb/ldclient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,18 @@ def initialize(sdk_key, config = Config.default, wait_for_sec = 5)
end

ready = @data_source.start
if wait_for_sec > 0
ok = ready.wait(wait_for_sec)
if !ok
@config.logger.error { "[LDClient] Timeout encountered waiting for LaunchDarkly client initialization" }
elsif !@data_source.initialized?
@config.logger.error { "[LDClient] LaunchDarkly client initialization failed" }
end

return unless wait_for_sec > 0

if wait_for_sec > 60
@config.logger.warn { "[LDClient] Instantiated with high timeout parameter #{wait_for_sec}." }
end

ok = ready.wait(wait_for_sec)
if !ok
@config.logger.error { "[LDClient] Timeout encountered waiting for LaunchDarkly client initialization" }
elsif !@data_source.initialized?
@config.logger.error { "[LDClient] LaunchDarkly client initialization failed" }
end
end

Expand Down

0 comments on commit f7ba485

Please sign in to comment.