Skip to content

Commit f7ba485

Browse files
committed
fix: Log warning if provided high client init timeout
1 parent 629ecb5 commit f7ba485

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

lib/ldclient-rb/ldclient.rb

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,18 @@ def initialize(sdk_key, config = Config.default, wait_for_sec = 5)
124124
end
125125

126126
ready = @data_source.start
127-
if wait_for_sec > 0
128-
ok = ready.wait(wait_for_sec)
129-
if !ok
130-
@config.logger.error { "[LDClient] Timeout encountered waiting for LaunchDarkly client initialization" }
131-
elsif !@data_source.initialized?
132-
@config.logger.error { "[LDClient] LaunchDarkly client initialization failed" }
133-
end
127+
128+
return unless wait_for_sec > 0
129+
130+
if wait_for_sec > 60
131+
@config.logger.warn { "[LDClient] Instantiated with high timeout parameter #{wait_for_sec}." }
132+
end
133+
134+
ok = ready.wait(wait_for_sec)
135+
if !ok
136+
@config.logger.error { "[LDClient] Timeout encountered waiting for LaunchDarkly client initialization" }
137+
elsif !@data_source.initialized?
138+
@config.logger.error { "[LDClient] LaunchDarkly client initialization failed" }
134139
end
135140
end
136141

0 commit comments

Comments
 (0)