launchdarkly-server-sdk 5.8.0 → 5.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70c964dad6b0915f006bee0d90160fe04bdd4853
4
- data.tar.gz: f80c3dfe18ad4a70c0d7156ab06b748ffc897ae9
3
+ metadata.gz: dcb72b5ad43bf4a2f4250cbe1b12fb3eaf803e66
4
+ data.tar.gz: bd7ceebb0ff2a746d8b773fbeb7b3e287dcbcb01
5
5
  SHA512:
6
- metadata.gz: 8a31c4b4a77caec7e64b54b18aabdecb12f2b5a44432d4ef74c94c2a1b57dff8a4cbf38f8dc894be8fec6f999bdc8bb62ff6095d1670ac892969329c435c9ff7
7
- data.tar.gz: 2e21c5ad0cb881d99c905eaefc8952024d8fc12a1f28b1b2f4100cb39a95cdfa65d77b4a2067f3843ca9c79a446e6b071dd9c2470f2d0d0afba64d86365eb6cd
6
+ metadata.gz: 4f3d71bf78a2cc31574470fd57af2eee84b5222dfaddfe90160ecd2bda746e5137df3fed136d12578b01ae84364f2fd04477046964bc8f73e5bced212988c59a
7
+ data.tar.gz: 165bb1c1b646ca0f759bb081020a16fd78b5df014be47cb9c5386f7e99b2287dfb640b7e865230e7604886dd3ad933ebae3d82b113bce21f549e03e2875c7d03
@@ -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.8.0] - 2020-05-27
6
+ ### Added:
7
+ - In `LaunchDarkly::Integrations::Redis::new_feature_store`, if you pass in an externally created `pool`, you can now set the new option `pool_shutdown_on_close` to `false` to indicate that the SDK should _not_ shut down this pool if the SDK is shut down. The default behavior, as before, is that it will be shut down. (Thanks, [jacobthemyth](https://github.com/launchdarkly/ruby-server-sdk/pull/158)!)
8
+
5
9
  ## [5.7.4] - 2020-05-04
6
10
  ### Fixed:
7
11
  - 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))
@@ -1,94 +1,83 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- launchdarkly-server-sdk (5.8.0)
4
+ launchdarkly-server-sdk (5.8.1)
5
5
  concurrent-ruby (~> 1.0)
6
- json (>= 1.8, < 3)
6
+ json (~> 2.3.1)
7
7
  ld-eventsource (= 1.0.3)
8
8
  semantic (~> 1.6)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- aws-eventstream (1.0.1)
14
- aws-partitions (1.128.0)
15
- aws-sdk-core (3.44.2)
16
- aws-eventstream (~> 1.0)
17
- aws-partitions (~> 1.0)
18
- aws-sigv4 (~> 1.0)
13
+ aws-eventstream (1.1.0)
14
+ aws-partitions (1.388.0)
15
+ aws-sdk-core (3.109.1)
16
+ aws-eventstream (~> 1, >= 1.0.2)
17
+ aws-partitions (~> 1, >= 1.239.0)
18
+ aws-sigv4 (~> 1.1)
19
19
  jmespath (~> 1.0)
20
- aws-sdk-dynamodb (1.19.0)
21
- aws-sdk-core (~> 3, >= 3.39.0)
22
- aws-sigv4 (~> 1.0)
23
- aws-sigv4 (1.0.3)
24
- codeclimate-test-reporter (0.6.0)
25
- simplecov (>= 0.7.1, < 1.0.0)
26
- concurrent-ruby (1.1.6)
27
- connection_pool (2.2.1)
28
- diff-lcs (1.3)
29
- diplomat (2.0.2)
30
- faraday (~> 0.9)
31
- json
32
- docile (1.1.5)
33
- faraday (0.15.4)
20
+ aws-sdk-dynamodb (1.55.0)
21
+ aws-sdk-core (~> 3, >= 3.109.0)
22
+ aws-sigv4 (~> 1.1)
23
+ aws-sigv4 (1.2.2)
24
+ aws-eventstream (~> 1, >= 1.0.2)
25
+ concurrent-ruby (1.1.7)
26
+ connection_pool (2.2.3)
27
+ deep_merge (1.2.1)
28
+ diff-lcs (1.4.4)
29
+ diplomat (2.4.2)
30
+ deep_merge (~> 1.0, >= 1.0.1)
31
+ faraday (>= 0.9, < 1.1.0)
32
+ faraday (0.17.3)
34
33
  multipart-post (>= 1.2, < 3)
35
- ffi (1.9.25)
36
- ffi (1.9.25-java)
34
+ ffi (1.12.0)
37
35
  hitimes (1.3.1)
38
- hitimes (1.3.1-java)
39
36
  http_tools (0.4.5)
40
37
  jmespath (1.4.0)
41
- json (1.8.6)
42
- json (1.8.6-java)
38
+ json (2.3.1)
43
39
  ld-eventsource (1.0.3)
44
40
  concurrent-ruby (~> 1.0)
45
41
  http_tools (~> 0.4.5)
46
42
  socketry (~> 0.5.1)
47
- listen (3.1.5)
48
- rb-fsevent (~> 0.9, >= 0.9.4)
49
- rb-inotify (~> 0.9, >= 0.9.7)
50
- ruby_dep (~> 1.2)
51
- multipart-post (2.0.0)
52
- rb-fsevent (0.10.3)
53
- rb-inotify (0.9.10)
54
- ffi (>= 0.5.0, < 2)
43
+ listen (3.2.1)
44
+ rb-fsevent (~> 0.10, >= 0.10.3)
45
+ rb-inotify (~> 0.9, >= 0.9.10)
46
+ multipart-post (2.1.1)
47
+ rb-fsevent (0.10.4)
48
+ rb-inotify (0.10.1)
49
+ ffi (~> 1.0)
55
50
  redis (3.3.5)
56
- rspec (3.7.0)
57
- rspec-core (~> 3.7.0)
58
- rspec-expectations (~> 3.7.0)
59
- rspec-mocks (~> 3.7.0)
60
- rspec-core (3.7.1)
61
- rspec-support (~> 3.7.0)
62
- rspec-expectations (3.7.0)
51
+ rspec (3.9.0)
52
+ rspec-core (~> 3.9.0)
53
+ rspec-expectations (~> 3.9.0)
54
+ rspec-mocks (~> 3.9.0)
55
+ rspec-core (3.9.3)
56
+ rspec-support (~> 3.9.3)
57
+ rspec-expectations (3.9.3)
63
58
  diff-lcs (>= 1.2.0, < 2.0)
64
- rspec-support (~> 3.7.0)
65
- rspec-mocks (3.7.0)
59
+ rspec-support (~> 3.9.0)
60
+ rspec-mocks (3.9.1)
66
61
  diff-lcs (>= 1.2.0, < 2.0)
67
- rspec-support (~> 3.7.0)
68
- rspec-support (3.7.0)
62
+ rspec-support (~> 3.9.0)
63
+ rspec-support (3.9.4)
69
64
  rspec_junit_formatter (0.3.0)
70
65
  rspec-core (>= 2, < 4, != 2.12.0)
71
- ruby_dep (1.5.0)
72
66
  semantic (1.6.1)
73
- simplecov (0.15.1)
74
- docile (~> 1.1.0)
75
- json (>= 1.8, < 3)
76
- simplecov-html (~> 0.10.0)
77
- simplecov-html (0.10.2)
78
67
  socketry (0.5.1)
79
68
  hitimes (~> 1.2)
80
- timecop (0.9.1)
69
+ timecop (0.9.2)
81
70
 
82
71
  PLATFORMS
83
- java
84
72
  ruby
85
73
 
86
74
  DEPENDENCIES
87
75
  aws-sdk-dynamodb (~> 1.18)
88
- bundler (~> 1.7)
89
- codeclimate-test-reporter (~> 0)
76
+ bundler (~> 1.17)
90
77
  connection_pool (>= 2.1.2)
91
78
  diplomat (>= 2.0.2)
79
+ faraday (~> 0.17)
80
+ ffi (<= 1.12)
92
81
  launchdarkly-server-sdk!
93
82
  listen (~> 3.0)
94
83
  redis (~> 3.3.5)
@@ -21,18 +21,25 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ["lib"]
22
22
 
23
23
  spec.add_development_dependency "aws-sdk-dynamodb", "~> 1.18"
24
- spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "bundler", "~> 1.17"
25
25
  spec.add_development_dependency "rspec", "~> 3.2"
26
- spec.add_development_dependency "codeclimate-test-reporter", "~> 0"
27
26
  spec.add_development_dependency "diplomat", ">= 2.0.2"
28
27
  spec.add_development_dependency "redis", "~> 3.3.5"
29
28
  spec.add_development_dependency "connection_pool", ">= 2.1.2"
30
29
  spec.add_development_dependency "rspec_junit_formatter", "~> 0.3.0"
31
30
  spec.add_development_dependency "timecop", "~> 0.9.1"
32
31
  spec.add_development_dependency "listen", "~> 3.0" # see file_data_source.rb
32
+ # these are transitive dependencies of listen and consul respectively
33
+ # we constrain them here to make sure the ruby 2.2, 2.3, and 2.4 CI
34
+ # cases all pass
35
+ spec.add_development_dependency "ffi", "<= 1.12" # >1.12 doesnt support ruby 2.2
36
+ spec.add_development_dependency "faraday", "~> 0.17" # >=0.18 doesnt support ruby 2.2
33
37
 
34
- spec.add_runtime_dependency "json", [">= 1.8", "< 3"]
35
38
  spec.add_runtime_dependency "semantic", "~> 1.6"
36
39
  spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
37
40
  spec.add_runtime_dependency "ld-eventsource", "1.0.3"
41
+
42
+ # lock json to 2.3.x as ruby libraries often remove
43
+ # support for older ruby versions in minor releases
44
+ spec.add_runtime_dependency "json", "~> 2.3.1"
38
45
  end
@@ -363,12 +363,12 @@ module LaunchDarkly
363
363
  return NullUpdateProcessor.new
364
364
  end
365
365
  raise ArgumentError, "sdk_key must not be nil" if sdk_key.nil? # see LDClient constructor comment on sdk_key
366
- requestor = Requestor.new(sdk_key, config)
367
366
  if config.stream?
368
- StreamProcessor.new(sdk_key, config, requestor, diagnostic_accumulator)
367
+ StreamProcessor.new(sdk_key, config, diagnostic_accumulator)
369
368
  else
370
369
  config.logger.info { "Disabling streaming API" }
371
370
  config.logger.warn { "You should only disable the streaming API if instructed to do so by LaunchDarkly support" }
371
+ requestor = Requestor.new(sdk_key, config)
372
372
  PollingProcessor.new(config, requestor)
373
373
  end
374
374
  end
@@ -26,14 +26,6 @@ module LaunchDarkly
26
26
  @cache = @config.cache_store
27
27
  end
28
28
 
29
- def request_flag(key)
30
- make_request("/sdk/latest-flags/" + key)
31
- end
32
-
33
- def request_segment(key)
34
- make_request("/sdk/latest-segments/" + key)
35
- end
36
-
37
29
  def request_all_data()
38
30
  make_request("/sdk/latest-all")
39
31
  end
@@ -10,10 +10,6 @@ module LaunchDarkly
10
10
  # @private
11
11
  DELETE = :delete
12
12
  # @private
13
- INDIRECT_PUT = :'indirect/put'
14
- # @private
15
- INDIRECT_PATCH = :'indirect/patch'
16
- # @private
17
13
  READ_TIMEOUT_SECONDS = 300 # 5 minutes; the stream should send a ping every 3 minutes
18
14
 
19
15
  # @private
@@ -24,11 +20,10 @@ module LaunchDarkly
24
20
 
25
21
  # @private
26
22
  class StreamProcessor
27
- def initialize(sdk_key, config, requestor, diagnostic_accumulator = nil)
23
+ def initialize(sdk_key, config, diagnostic_accumulator = nil)
28
24
  @sdk_key = sdk_key
29
25
  @config = config
30
26
  @feature_store = config.feature_store
31
- @requestor = requestor
32
27
  @initialized = Concurrent::AtomicBoolean.new(false)
33
28
  @started = Concurrent::AtomicBoolean.new(false)
34
29
  @stopped = Concurrent::AtomicBoolean.new(false)
@@ -112,24 +107,6 @@ module LaunchDarkly
112
107
  break
113
108
  end
114
109
  end
115
- elsif method == INDIRECT_PUT
116
- all_data = @requestor.request_all_data
117
- @feature_store.init({
118
- FEATURES => all_data[:flags],
119
- SEGMENTS => all_data[:segments]
120
- })
121
- @initialized.make_true
122
- @config.logger.info { "[LDClient] Stream initialized (via indirect message)" }
123
- elsif method == INDIRECT_PATCH
124
- key = key_for_path(FEATURES, message.data)
125
- if key
126
- @feature_store.upsert(FEATURES, @requestor.request_flag(key))
127
- else
128
- key = key_for_path(SEGMENTS, message.data)
129
- if key
130
- @feature_store.upsert(SEGMENTS, @requestor.request_segment(key))
131
- end
132
- end
133
110
  else
134
111
  @config.logger.warn { "[LDClient] Unknown message received: #{method}" }
135
112
  end
@@ -1,3 +1,3 @@
1
1
  module LaunchDarkly
2
- VERSION = "5.8.0"
2
+ VERSION = "5.8.1"
3
3
  end
@@ -193,38 +193,4 @@ describe LaunchDarkly::Requestor do
193
193
  end
194
194
  end
195
195
  end
196
-
197
- describe "request_flag" do
198
- it "uses expected URI and headers" do
199
- with_server do |server|
200
- with_requestor(server.base_uri.to_s) do |requestor|
201
- server.setup_ok_response("/", "{}")
202
- requestor.request_flag("key")
203
- expect(server.requests.count).to eq 1
204
- expect(server.requests[0].unparsed_uri).to eq "/sdk/latest-flags/key"
205
- expect(server.requests[0].header).to include({
206
- "authorization" => [ $sdk_key ],
207
- "user-agent" => [ "RubyClient/" + LaunchDarkly::VERSION ]
208
- })
209
- end
210
- end
211
- end
212
- end
213
-
214
- describe "request_segment" do
215
- it "uses expected URI and headers" do
216
- with_server do |server|
217
- with_requestor(server.base_uri.to_s) do |requestor|
218
- server.setup_ok_response("/", "{}")
219
- requestor.request_segment("key")
220
- expect(server.requests.count).to eq 1
221
- expect(server.requests[0].unparsed_uri).to eq "/sdk/latest-segments/key"
222
- expect(server.requests[0].header).to include({
223
- "authorization" => [ $sdk_key ],
224
- "user-agent" => [ "RubyClient/" + LaunchDarkly::VERSION ]
225
- })
226
- end
227
- end
228
- end
229
- end
230
196
  end
@@ -1,6 +1,3 @@
1
- require "codeclimate-test-reporter"
2
- CodeClimate::TestReporter.start
3
-
4
1
  require "ldclient-rb"
5
2
 
6
3
  $null_log = ::Logger.new($stdout)
@@ -4,8 +4,7 @@ require "spec_helper"
4
4
  describe LaunchDarkly::StreamProcessor do
5
5
  subject { LaunchDarkly::StreamProcessor }
6
6
  let(:config) { LaunchDarkly::Config.new }
7
- let(:requestor) { double() }
8
- let(:processor) { subject.new("sdk_key", config, requestor) }
7
+ let(:processor) { subject.new("sdk_key", config) }
9
8
 
10
9
  describe '#process_message' do
11
10
  let(:put_message) { SSE::StreamEvent.new(:put, '{"data":{"flags":{"asdf": {"key": "asdf"}},"segments":{"segkey": {"key": "segkey"}}}}') }
@@ -13,8 +12,6 @@ describe LaunchDarkly::StreamProcessor do
13
12
  let(:patch_seg_message) { SSE::StreamEvent.new(:patch, '{"path": "/segments/key", "data": {"key": "asdf", "version": 1}}') }
14
13
  let(:delete_flag_message) { SSE::StreamEvent.new(:delete, '{"path": "/flags/key", "version": 2}') }
15
14
  let(:delete_seg_message) { SSE::StreamEvent.new(:delete, '{"path": "/segments/key", "version": 2}') }
16
- let(:indirect_patch_flag_message) { SSE::StreamEvent.new(:'indirect/patch', "/flags/key") }
17
- let(:indirect_patch_segment_message) { SSE::StreamEvent.new(:'indirect/patch', "/segments/key") }
18
15
 
19
16
  it "will accept PUT methods" do
20
17
  processor.send(:process_message, put_message)
@@ -39,18 +36,6 @@ describe LaunchDarkly::StreamProcessor do
39
36
  processor.send(:process_message, delete_seg_message)
40
37
  expect(config.feature_store.get(LaunchDarkly::SEGMENTS, "key")).to eq(nil)
41
38
  end
42
- it "will accept INDIRECT PATCH method for flags" do
43
- flag = { key: 'key', version: 1 }
44
- allow(requestor).to receive(:request_flag).with(flag[:key]).and_return(flag)
45
- processor.send(:process_message, indirect_patch_flag_message);
46
- expect(config.feature_store.get(LaunchDarkly::FEATURES, flag[:key])).to eq(flag)
47
- end
48
- it "will accept INDIRECT PATCH method for segments" do
49
- segment = { key: 'key', version: 1 }
50
- allow(requestor).to receive(:request_segment).with(segment[:key]).and_return(segment)
51
- processor.send(:process_message, indirect_patch_segment_message);
52
- expect(config.feature_store.get(LaunchDarkly::SEGMENTS, segment[:key])).to eq(segment)
53
- end
54
39
  it "will log a warning if the method is not recognized" do
55
40
  expect(processor.instance_variable_get(:@config).logger).to receive :warn
56
41
  processor.send(:process_message, SSE::StreamEvent.new(type: :get, data: "", id: nil))
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.8.0
4
+ version: 5.8.1
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-27 00:00:00.000000000 Z
11
+ date: 2020-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-dynamodb
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.7'
33
+ version: '1.17'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.7'
40
+ version: '1.17'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.2'
55
- - !ruby/object:Gem::Dependency
56
- name: codeclimate-test-reporter
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: diplomat
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -151,25 +137,33 @@ dependencies:
151
137
  - !ruby/object:Gem::Version
152
138
  version: '3.0'
153
139
  - !ruby/object:Gem::Dependency
154
- name: json
140
+ name: ffi
155
141
  requirement: !ruby/object:Gem::Requirement
156
142
  requirements:
157
- - - ">="
143
+ - - "<="
158
144
  - !ruby/object:Gem::Version
159
- version: '1.8'
160
- - - "<"
161
- - !ruby/object:Gem::Version
162
- version: '3'
163
- type: :runtime
145
+ version: '1.12'
146
+ type: :development
164
147
  prerelease: false
165
148
  version_requirements: !ruby/object:Gem::Requirement
166
149
  requirements:
167
- - - ">="
150
+ - - "<="
168
151
  - !ruby/object:Gem::Version
169
- version: '1.8'
170
- - - "<"
152
+ version: '1.12'
153
+ - !ruby/object:Gem::Dependency
154
+ name: faraday
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '0.17'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
171
165
  - !ruby/object:Gem::Version
172
- version: '3'
166
+ version: '0.17'
173
167
  - !ruby/object:Gem::Dependency
174
168
  name: semantic
175
169
  requirement: !ruby/object:Gem::Requirement
@@ -212,6 +206,20 @@ dependencies:
212
206
  - - '='
213
207
  - !ruby/object:Gem::Version
214
208
  version: 1.0.3
209
+ - !ruby/object:Gem::Dependency
210
+ name: json
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: 2.3.1
216
+ type: :runtime
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: 2.3.1
215
223
  description: Official LaunchDarkly SDK for Ruby
216
224
  email:
217
225
  - team@launchdarkly.com