Skip to content

Commit eeb9906

Browse files
authored
fix: Calling stop in ldd mode no longer raises an exception (#235)
1 parent 432c53d commit eeb9906

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

lib/ldclient-rb/impl/integrations/redis_impl.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def initialize(opts)
112112
@pool = create_redis_pool(opts)
113113

114114
# shutdown pool on close unless the client passed a custom pool and specified not to shutdown
115-
@pool_shutdown_on_close = (!opts[:pool] || opts.fetch(:pool_shutdown_on_close, true))
115+
@pool_shutdown_on_close = !opts[:pool] || opts.fetch(:pool_shutdown_on_close, true)
116116

117117
@prefix = opts[:prefix] || LaunchDarkly::Integrations::Redis::default_prefix
118118
@logger = opts[:logger] || Config.default_logger

lib/ldclient-rb/ldclient.rb

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def initialize(sdk_key, config = Config.default, wait_for_sec = 5)
8787

8888
if @config.use_ldd?
8989
@config.logger.info { "[LDClient] Started LaunchDarkly Client in LDD mode" }
90+
@data_source = NullUpdateProcessor.new
9091
return # requestor and update processor are not used in this mode
9192
end
9293

spec/ldclient_spec.rb

+17
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@ module LaunchDarkly
4545
end
4646
end
4747

48+
context "client can be stopped" do
49+
it "when in online mode" do
50+
client = subject.new("sdk-key", Config.new)
51+
client.close()
52+
end
53+
54+
it "when in offline mode" do
55+
client = subject.new("sdk-key", Config.new(offline: true))
56+
client.close()
57+
end
58+
59+
it "when in ldd mode" do
60+
client = subject.new("sdk-key", Config.new(use_ldd: true))
61+
client.close()
62+
end
63+
end
64+
4865
context "secure_mode_hash" do
4966
it "will return the expected value for a known message and secret" do
5067
ensure_close(subject.new("secret", test_config)) do |client|

0 commit comments

Comments
 (0)