launchdarkly-server-sdk 5.7.4 → 5.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/ldclient-rb/impl/integrations/redis_impl.rb +3 -0
- data/lib/ldclient-rb/integrations/redis.rb +3 -0
- data/lib/ldclient-rb/redis_store.rb +1 -0
- data/lib/ldclient-rb/version.rb +1 -1
- data/spec/redis_feature_store_spec.rb +33 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70c964dad6b0915f006bee0d90160fe04bdd4853
|
4
|
+
data.tar.gz: f80c3dfe18ad4a70c0d7156ab06b748ffc897ae9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a31c4b4a77caec7e64b54b18aabdecb12f2b5a44432d4ef74c94c2a1b57dff8a4cbf38f8dc894be8fec6f999bdc8bb62ff6095d1670ac892969329c435c9ff7
|
7
|
+
data.tar.gz: 2e21c5ad0cb881d99c905eaefc8952024d8fc12a1f28b1b2f4100cb39a95cdfa65d77b4a2067f3843ca9c79a446e6b071dd9c2470f2d0d0afba64d86365eb6cd
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
All notable changes to the LaunchDarkly Ruby SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
|
4
4
|
|
5
|
+
## [5.7.4] - 2020-05-04
|
6
|
+
### Fixed:
|
7
|
+
- Setting a user's `custom` property explicitly to `nil`, rather than omitting it entirely or setting it to an empty hash, would cause the SDK to log an error and drop the current batch of analytics events. Now, it will be treated the same as an empty hash. ([#147](https://github.com/launchdarkly/ruby-server-sdk/issues/147))
|
8
|
+
|
5
9
|
## [5.7.3] - 2020-04-27
|
6
10
|
### Changed:
|
7
11
|
- Previously, installing the SDK in an environment that did not have `openssl` would cause a failure at build time. The SDK still requires `openssl` at runtime, but this check has been removed because it caused the `rake` problem mentioned below, and because `openssl` is normally bundled in modern Ruby versions.
|
data/Gemfile.lock
CHANGED
@@ -33,6 +33,8 @@ module LaunchDarkly
|
|
33
33
|
@pool = opts[:pool] || ConnectionPool.new(size: max_connections) do
|
34
34
|
::Redis.new(@redis_opts)
|
35
35
|
end
|
36
|
+
# shutdown pool on close unless the client passed a custom pool and specified not to shutdown
|
37
|
+
@pool_shutdown_on_close = (!opts[:pool] || opts.fetch(:pool_shutdown_on_close, true))
|
36
38
|
@prefix = opts[:prefix] || LaunchDarkly::Integrations::Redis::default_prefix
|
37
39
|
@logger = opts[:logger] || Config.default_logger
|
38
40
|
@test_hook = opts[:test_hook] # used for unit tests, deliberately undocumented
|
@@ -118,6 +120,7 @@ module LaunchDarkly
|
|
118
120
|
|
119
121
|
def stop
|
120
122
|
if @stopped.make_true
|
123
|
+
return unless @pool_shutdown_on_close
|
121
124
|
@pool.shutdown { |redis| redis.close }
|
122
125
|
end
|
123
126
|
end
|
@@ -45,6 +45,9 @@ module LaunchDarkly
|
|
45
45
|
# @option opts [Integer] :expiration (15) expiration time for the in-memory cache, in seconds; 0 for no local caching
|
46
46
|
# @option opts [Integer] :capacity (1000) maximum number of items in the cache
|
47
47
|
# @option opts [Object] :pool custom connection pool, if desired
|
48
|
+
# @option opts [Boolean] :pool_shutdown_on_close whether calling `close` should shutdown the custom connection pool;
|
49
|
+
# this is true by default, and should be set to false only if you are managing the pool yourself and want its
|
50
|
+
# lifecycle to be independent of the SDK client
|
48
51
|
# @return [LaunchDarkly::Interfaces::FeatureStore] a feature store object
|
49
52
|
#
|
50
53
|
def self.new_feature_store(opts)
|
@@ -35,6 +35,7 @@ module LaunchDarkly
|
|
35
35
|
# @option opts [Integer] :expiration expiration time for the in-memory cache, in seconds; 0 for no local caching
|
36
36
|
# @option opts [Integer] :capacity maximum number of feature flags (or related objects) to cache locally
|
37
37
|
# @option opts [Object] :pool custom connection pool, if desired
|
38
|
+
# @option opts [Boolean] :pool_shutdown_on_close whether calling `close` should shutdown the custom connection pool.
|
38
39
|
#
|
39
40
|
def initialize(opts = {})
|
40
41
|
core = LaunchDarkly::Impl::Integrations::Redis::RedisFeatureStoreCore.new(opts)
|
data/lib/ldclient-rb/version.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "connection_pool"
|
1
2
|
require "feature_store_spec_base"
|
2
3
|
require "json"
|
3
4
|
require "redis"
|
@@ -27,11 +28,11 @@ end
|
|
27
28
|
|
28
29
|
describe LaunchDarkly::RedisFeatureStore do
|
29
30
|
subject { LaunchDarkly::RedisFeatureStore }
|
30
|
-
|
31
|
+
|
31
32
|
break if ENV['LD_SKIP_DATABASE_TESTS'] == '1'
|
32
33
|
|
33
34
|
# These tests will all fail if there isn't a Redis instance running on the default port.
|
34
|
-
|
35
|
+
|
35
36
|
context "real Redis with local cache" do
|
36
37
|
include_examples "feature_store", method(:create_redis_store), method(:clear_all_data)
|
37
38
|
end
|
@@ -59,7 +60,7 @@ describe LaunchDarkly::RedisFeatureStore do
|
|
59
60
|
flag = { key: "foo", version: 1 }
|
60
61
|
test_hook = make_concurrent_modifier_test_hook(other_client, flag, 2, 4)
|
61
62
|
store = create_redis_store({ test_hook: test_hook })
|
62
|
-
|
63
|
+
|
63
64
|
begin
|
64
65
|
store.init(LaunchDarkly::FEATURES => { flag[:key] => flag })
|
65
66
|
|
@@ -77,7 +78,7 @@ describe LaunchDarkly::RedisFeatureStore do
|
|
77
78
|
flag = { key: "foo", version: 1 }
|
78
79
|
test_hook = make_concurrent_modifier_test_hook(other_client, flag, 3, 3)
|
79
80
|
store = create_redis_store({ test_hook: test_hook })
|
80
|
-
|
81
|
+
|
81
82
|
begin
|
82
83
|
store.init(LaunchDarkly::FEATURES => { flag[:key] => flag })
|
83
84
|
|
@@ -89,4 +90,32 @@ describe LaunchDarkly::RedisFeatureStore do
|
|
89
90
|
other_client.close
|
90
91
|
end
|
91
92
|
end
|
93
|
+
|
94
|
+
it "shuts down a custom Redis pool by default" do
|
95
|
+
unowned_pool = ConnectionPool.new(size: 1, timeout: 1) { Redis.new({ url: "redis://localhost:6379" }) }
|
96
|
+
store = create_redis_store({ pool: unowned_pool })
|
97
|
+
|
98
|
+
begin
|
99
|
+
store.init(LaunchDarkly::FEATURES => { })
|
100
|
+
store.stop
|
101
|
+
|
102
|
+
expect { unowned_pool.with {} }.to raise_error(ConnectionPool::PoolShuttingDownError)
|
103
|
+
ensure
|
104
|
+
unowned_pool.shutdown { |conn| conn.close }
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
it "doesn't shut down a custom Redis pool if pool_shutdown_on_close = false" do
|
109
|
+
unowned_pool = ConnectionPool.new(size: 1, timeout: 1) { Redis.new({ url: "redis://localhost:6379" }) }
|
110
|
+
store = create_redis_store({ pool: unowned_pool, pool_shutdown_on_close: false })
|
111
|
+
|
112
|
+
begin
|
113
|
+
store.init(LaunchDarkly::FEATURES => { })
|
114
|
+
store.stop
|
115
|
+
|
116
|
+
expect { unowned_pool.with {} }.not_to raise_error(ConnectionPool::PoolShuttingDownError)
|
117
|
+
ensure
|
118
|
+
unowned_pool.shutdown { |conn| conn.close }
|
119
|
+
end
|
120
|
+
end
|
92
121
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: launchdarkly-server-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LaunchDarkly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-dynamodb
|