launchdarkly-server-sdk 5.7.2 → 5.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3dd5750bde3461f500b79c5542aa1e7bd3c0f54a
4
- data.tar.gz: 5f83fba1e17f45975823cae9a6d011a3e4ef22ec
3
+ metadata.gz: ab666bc37fa5a2f111f10b81d7cf0938b9f9bfc0
4
+ data.tar.gz: 1f6564ed51bdfc73c62016c27e64571476165b55
5
5
  SHA512:
6
- metadata.gz: eb39d85a5ad9f752729e0ebf0431c4c76b7b23c9fabec7d9494cfef30946f10f9c8e6a4f3d575fb1d9203c4ad21c53e4db796e878be173f306ae74f3c3c5c5a7
7
- data.tar.gz: '07278a34c36c2f952a0e1c503f019959cbd0b45ba13c6cc021cc8a83ddd2895df5650e7c5adafe3ad0bea6e09497831d21581b74ccffd9e3f236770548ea44c8'
6
+ metadata.gz: d76941981b9b7144d64a49b735b155dd79f0f37163612d5ad88751b7666f133310ecbbc6caae7598d4d775c9ef2e41f21276c8f36e11e0628f6e97a28df94419
7
+ data.tar.gz: 7dbbd6e3f3cd865a372ab713f528c380f232c186d3c2b153073cb90256159fbd44dc1dcb7a0fcfea23d4518cb63b1ff72cff8fac8d48f2e4f030da1f65c6d648
@@ -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.2] - 2020-03-27
6
+ ### Fixed:
7
+ - Fixed a bug in the 5.7.0 and 5.7.1 releases that caused analytics events not to be sent unless diagnostic events were explicitly disabled. This also caused an error to be logged: `undefined method started?`.
8
+
5
9
  ## [5.7.1] - 2020-03-18
6
10
  ### Fixed:
7
11
  - The backoff delay logic for reconnecting after a stream failure was broken so that if a failure occurred after a stream had been active for at least 60 seconds, retries would use _no_ delay, potentially causing a flood of requests and a spike in CPU usage. This bug was introduced in version 5.5.0 of the SDK.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- launchdarkly-server-sdk (5.7.2)
4
+ launchdarkly-server-sdk (5.7.3)
5
5
  concurrent-ruby (~> 1.0)
6
6
  json (>= 1.8, < 3)
7
7
  ld-eventsource (= 1.0.3)
@@ -19,7 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
21
  spec.require_paths = ["lib"]
22
- spec.extensions = 'ext/mkrf_conf.rb'
23
22
 
24
23
  spec.add_development_dependency "aws-sdk-dynamodb", "~> 1.18"
25
24
  spec.add_development_dependency "bundler", "~> 1.7"
@@ -140,35 +140,44 @@ module LaunchDarkly
140
140
  end,
141
141
  endsWith:
142
142
  lambda do |a, b|
143
- (a.is_a? String) && (a.end_with? b)
143
+ (a.is_a? String) && (b.is_a? String) && (a.end_with? b)
144
144
  end,
145
145
  startsWith:
146
146
  lambda do |a, b|
147
- (a.is_a? String) && (a.start_with? b)
147
+ (a.is_a? String) && (b.is_a? String) && (a.start_with? b)
148
148
  end,
149
149
  matches:
150
150
  lambda do |a, b|
151
- (b.is_a? String) && !(Regexp.new b).match(a).nil?
151
+ if (b.is_a? String) && (b.is_a? String)
152
+ begin
153
+ re = Regexp.new b
154
+ !re.match(a).nil?
155
+ rescue
156
+ false
157
+ end
158
+ else
159
+ false
160
+ end
152
161
  end,
153
162
  contains:
154
163
  lambda do |a, b|
155
- (a.is_a? String) && (a.include? b)
164
+ (a.is_a? String) && (b.is_a? String) && (a.include? b)
156
165
  end,
157
166
  lessThan:
158
167
  lambda do |a, b|
159
- (a.is_a? Numeric) && (a < b)
168
+ (a.is_a? Numeric) && (b.is_a? Numeric) && (a < b)
160
169
  end,
161
170
  lessThanOrEqual:
162
171
  lambda do |a, b|
163
- (a.is_a? Numeric) && (a <= b)
172
+ (a.is_a? Numeric) && (b.is_a? Numeric) && (a <= b)
164
173
  end,
165
174
  greaterThan:
166
175
  lambda do |a, b|
167
- (a.is_a? Numeric) && (a > b)
176
+ (a.is_a? Numeric) && (b.is_a? Numeric) && (a > b)
168
177
  end,
169
178
  greaterThanOrEqual:
170
179
  lambda do |a, b|
171
- (a.is_a? Numeric) && (a >= b)
180
+ (a.is_a? Numeric) && (b.is_a? Numeric) && (a >= b)
172
181
  end,
173
182
  before:
174
183
  comparator(DATE_OPERAND) { |n| n < 0 },
@@ -91,6 +91,7 @@ module LaunchDarkly
91
91
  # @private
92
92
  class EventProcessor
93
93
  def initialize(sdk_key, config, client = nil, diagnostic_accumulator = nil, test_properties = nil)
94
+ raise ArgumentError, "sdk_key must not be nil" if sdk_key.nil? # see LDClient constructor comment on sdk_key
94
95
  @logger = config.logger
95
96
  @inbox = SizedQueue.new(config.capacity < 100 ? 100 : config.capacity)
96
97
  @flush_task = Concurrent::TimerTask.new(execution_interval: config.flush_interval) do
@@ -33,6 +33,16 @@ module LaunchDarkly
33
33
  # @return [LDClient] The LaunchDarkly client instance
34
34
  #
35
35
  def initialize(sdk_key, config = Config.default, wait_for_sec = 5)
36
+ # Note that sdk_key is normally a required parameter, and a nil value would cause the SDK to
37
+ # fail in most configurations. However, there are some configurations where it would be OK
38
+ # (offline = true, *or* we are using LDD mode or the file data source and events are disabled
39
+ # so we're not connecting to any LD services) so rather than try to check for all of those
40
+ # up front, we will let the constructors for the data source implementations implement this
41
+ # fail-fast as appropriate, and just check here for the part regarding events.
42
+ if !config.offline? && config.send_events
43
+ raise ArgumentError, "sdk_key must not be nil" if sdk_key.nil?
44
+ end
45
+
36
46
  @sdk_key = sdk_key
37
47
 
38
48
  @event_factory_default = EventFactory.new(false)
@@ -352,6 +362,7 @@ module LaunchDarkly
352
362
  if config.offline?
353
363
  return NullUpdateProcessor.new
354
364
  end
365
+ raise ArgumentError, "sdk_key must not be nil" if sdk_key.nil? # see LDClient constructor comment on sdk_key
355
366
  requestor = Requestor.new(sdk_key, config)
356
367
  if config.stream?
357
368
  StreamProcessor.new(sdk_key, config, requestor, diagnostic_accumulator)
@@ -1,3 +1,3 @@
1
1
  module LaunchDarkly
2
- VERSION = "5.7.2"
2
+ VERSION = "5.7.3"
3
3
  end
@@ -495,13 +495,13 @@ describe LaunchDarkly::Evaluation do
495
495
  # mixed strings and numbers
496
496
  [ :in, "99", 99, false ],
497
497
  [ :in, 99, "99", false ],
498
- #[ :contains, "99", 99, false ], # currently throws exception - would return false in Java SDK
499
- #[ :startsWith, "99", 99, false ], # currently throws exception - would return false in Java SDK
500
- #[ :endsWith, "99", 99, false ] # currently throws exception - would return false in Java SDK
498
+ [ :contains, "99", 99, false ],
499
+ [ :startsWith, "99", 99, false ],
500
+ [ :endsWith, "99", 99, false ],
501
501
  [ :lessThanOrEqual, "99", 99, false ],
502
- #[ :lessThanOrEqual, 99, "99", false ], # currently throws exception - would return false in Java SDK
502
+ [ :lessThanOrEqual, 99, "99", false ],
503
503
  [ :greaterThanOrEqual, "99", 99, false ],
504
- #[ :greaterThanOrEqual, 99, "99", false ], # currently throws exception - would return false in Java SDK
504
+ [ :greaterThanOrEqual, 99, "99", false ],
505
505
 
506
506
  # regex
507
507
  [ :matches, "hello world", "hello.*rld", true ],
@@ -509,7 +509,7 @@ describe LaunchDarkly::Evaluation do
509
509
  [ :matches, "hello world", "l+", true ],
510
510
  [ :matches, "hello world", "(world|planet)", true ],
511
511
  [ :matches, "hello world", "aloha", false ],
512
- #[ :matches, "hello world", "***not a regex", false ] # currently throws exception - same as Java SDK
512
+ [ :matches, "hello world", "***not a regex", false ],
513
513
 
514
514
  # dates
515
515
  [ :before, dateStr1, dateStr2, true ],
@@ -49,6 +49,46 @@ describe LaunchDarkly::LDClient do
49
49
  client.instance_variable_get(:@event_processor)
50
50
  end
51
51
 
52
+ describe "constructor requirement of non-nil sdk key" do
53
+ it "is not enforced when offline" do
54
+ subject.new(nil, offline_config)
55
+ end
56
+
57
+ it "is not enforced if use_ldd is true and send_events is false" do
58
+ subject.new(nil, LaunchDarkly::Config.new({ use_ldd: true, send_events: false }))
59
+ end
60
+
61
+ it "is not enforced if using file data and send_events is false" do
62
+ source = LaunchDarkly::FileDataSource.factory({})
63
+ subject.new(nil, LaunchDarkly::Config.new({ data_source: source, send_events: false }))
64
+ end
65
+
66
+ it "is enforced in streaming mode even if send_events is false" do
67
+ expect {
68
+ subject.new(nil, LaunchDarkly::Config.new({ send_events: false }))
69
+ }.to raise_error(ArgumentError)
70
+ end
71
+
72
+ it "is enforced in polling mode even if send_events is false" do
73
+ expect {
74
+ subject.new(nil, LaunchDarkly::Config.new({ stream: false, send_events: false }))
75
+ }.to raise_error(ArgumentError)
76
+ end
77
+
78
+ it "is enforced if use_ldd is true and send_events is true" do
79
+ expect {
80
+ subject.new(nil, LaunchDarkly::Config.new({ use_ldd: true }))
81
+ }.to raise_error(ArgumentError)
82
+ end
83
+
84
+ it "is enforced if using file data and send_events is true" do
85
+ source = LaunchDarkly::FileDataSource.factory({})
86
+ expect {
87
+ subject.new(nil, LaunchDarkly::Config.new({ data_source: source }))
88
+ }.to raise_error(ArgumentError)
89
+ end
90
+ end
91
+
52
92
  describe '#variation' do
53
93
  feature_with_value = { key: "key", on: false, offVariation: 0, variations: ["value"], version: 100,
54
94
  trackEvents: true, debugEventsUntilDate: 1000 }
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.7.2
4
+ version: 5.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - LaunchDarkly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-27 00:00:00.000000000 Z
11
+ date: 2020-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-dynamodb
@@ -216,8 +216,7 @@ description: Official LaunchDarkly SDK for Ruby
216
216
  email:
217
217
  - team@launchdarkly.com
218
218
  executables: []
219
- extensions:
220
- - ext/mkrf_conf.rb
219
+ extensions: []
221
220
  extra_rdoc_files: []
222
221
  files:
223
222
  - ".circleci/config.yml"
@@ -239,7 +238,6 @@ files:
239
238
  - LICENSE.txt
240
239
  - README.md
241
240
  - azure-pipelines.yml
242
- - ext/mkrf_conf.rb
243
241
  - launchdarkly-server-sdk.gemspec
244
242
  - lib/launchdarkly-server-sdk.rb
245
243
  - lib/ldclient-rb.rb
@@ -1,11 +0,0 @@
1
- require "rubygems"
2
-
3
-
4
- # From http://stackoverflow.com/questions/5830835/how-to-add-openssl-dependency-to-gemspec
5
- # the whole reason this file exists: to return an error if openssl
6
- # isn't installed.
7
- require "openssl"
8
-
9
- f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w") # create dummy rakefile to indicate success
10
- f.write("task :default\n")
11
- f.close