launchdarkly-server-sdk 5.6.1 → 5.6.2

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: 634c7b652bbff689dc0d705f75536ee40e76648f
4
- data.tar.gz: 7c932f06ef8f16e2f5a13f7c34d19aa834acfeb0
3
+ metadata.gz: 0f95b72da90326fccd6fb823407b61ca1c686e53
4
+ data.tar.gz: 661768aaa51261feba0018cbc0f3ba793580c3e6
5
5
  SHA512:
6
- metadata.gz: 81c83640f62d49bed5f91cf9b77f551d0df663491ed96fbfadc69a68a5a09787667c26554a09098bad9b8ba4ef55c78b2e15ab7743c99a3ba43c80b3de48723c
7
- data.tar.gz: 72adc3f1ff659659c2093b3f81e680de298a15f20a43df7cc958c9a62040a8670e18505e604254f48401eb8fa5618d61873b7a22ba43fe1fe3a463f16f265a3f
6
+ metadata.gz: a409099d6bf0e5fb75b8d64ad05e52983bafb22f645620c8adb7403a0435a0ba9bd14068868b2ef1419f291431d6d517dad74284289f166e7ca21ca7156e0462
7
+ data.tar.gz: 72c021d8519a455da47ad3c5d8eacbbb79ef80ee068be1b37a5f200abdf8248e7741638de1f8811cbde03638635bc6a9029d90f90f2b6474b5d5e2fe8aa82b1e
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.6.1] - 2020-01-06
6
+ ### Fixed:
7
+ - In rare circumstances (depending on the exact data in the flag configuration, the flag's salt value, and the user properties), a percentage rollout could fail and return a default value, logging the error "Data inconsistency in feature flag ... variation/rollout object with no variation or rollout". This would happen if the user's hashed value fell exactly at the end of the last "bucket" (the last variation defined in the rollout). This has been fixed so that the user will get the last variation.
8
+
5
9
  ## [5.6.0] - 2019-08-28
6
10
  ### Added:
7
11
  - Added support for upcoming LaunchDarkly experimentation features. See `LDClient.track()`.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- launchdarkly-server-sdk (5.6.1)
4
+ launchdarkly-server-sdk (5.6.2)
5
5
  concurrent-ruby (~> 1.0)
6
6
  json (>= 1.8, < 3)
7
7
  ld-eventsource (= 1.0.1)
@@ -1,6 +1,7 @@
1
1
  require "concurrent"
2
2
  require "concurrent/atomics"
3
3
  require "concurrent/executors"
4
+ require "securerandom"
4
5
  require "thread"
5
6
  require "time"
6
7
 
@@ -359,6 +360,7 @@ module LaunchDarkly
359
360
  events_out = formatter.make_output_events(payload.events, payload.summary)
360
361
  res = nil
361
362
  body = events_out.to_json
363
+ payload_id = SecureRandom.uuid
362
364
  (0..1).each do |attempt|
363
365
  if attempt > 0
364
366
  config.logger.warn { "[LDClient] Will retry posting events after 1 second" }
@@ -374,6 +376,7 @@ module LaunchDarkly
374
376
  req["Authorization"] = sdk_key
375
377
  req["User-Agent"] = "RubyClient/" + LaunchDarkly::VERSION
376
378
  req["X-LaunchDarkly-Event-Schema"] = CURRENT_SCHEMA_VERSION.to_s
379
+ req["X-LaunchDarkly-Payload-ID"] = payload_id
377
380
  req["Connection"] = "keep-alive"
378
381
  res = client.request(req)
379
382
  rescue StandardError => exn
@@ -1,3 +1,3 @@
1
1
  module LaunchDarkly
2
- VERSION = "5.6.1"
2
+ VERSION = "5.6.2"
3
3
  end
data/spec/events_spec.rb CHANGED
@@ -416,6 +416,29 @@ describe LaunchDarkly::EventProcessor do
416
416
  expect(hc.get_request["authorization"]).to eq "sdk_key"
417
417
  end
418
418
 
419
+ it "sends unique payload IDs" do
420
+ @ep = subject.new("sdk_key", default_config, hc)
421
+ e = { kind: "identify", user: user }
422
+
423
+ @ep.add_event(e)
424
+ @ep.flush
425
+ @ep.wait_until_inactive
426
+ req0 = hc.get_request
427
+
428
+ @ep.add_event(e)
429
+ @ep.flush
430
+ @ep.wait_until_inactive
431
+ req1 = hc.get_request
432
+
433
+ id0 = req0["x-launchdarkly-payload-id"]
434
+ id1 = req1["x-launchdarkly-payload-id"]
435
+ expect(id0).not_to be_nil
436
+ expect(id0).not_to eq ""
437
+ expect(id1).not_to be nil
438
+ expect(id1).not_to eq ""
439
+ expect(id1).not_to eq id0
440
+ end
441
+
419
442
  def verify_unrecoverable_http_error(status)
420
443
  @ep = subject.new("sdk_key", default_config, hc)
421
444
  e = { kind: "identify", user: user }
@@ -442,8 +465,15 @@ describe LaunchDarkly::EventProcessor do
442
465
  @ep.flush
443
466
  @ep.wait_until_inactive
444
467
 
445
- expect(hc.get_request).not_to be_nil
446
- expect(hc.get_request).not_to be_nil
468
+ req0 = hc.get_request
469
+ expect(req0).not_to be_nil
470
+ req1 = hc.get_request
471
+ expect(req1).not_to be_nil
472
+ id0 = req0["x-launchdarkly-payload-id"]
473
+ expect(id0).not_to be_nil
474
+ expect(id0).not_to eq ""
475
+ expect(req1["x-launchdarkly-payload-id"]).to eq id0
476
+
447
477
  expect(hc.get_request).to be_nil # no 3rd request
448
478
 
449
479
  # now verify that a subsequent flush still generates a request
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.6.1
4
+ version: 5.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - LaunchDarkly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-07 00:00:00.000000000 Z
11
+ date: 2020-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-dynamodb