amplitude-experiment 1.1.2 → 1.1.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
  SHA256:
3
- metadata.gz: 53e7251a50e66bfd3145abbf399860592fec625dba57df40b84cd2f235a41fd3
4
- data.tar.gz: 7405cf8193e72163cc9df7d216460e2eee5b3352ff255e97eed7ec7f5de7367a
3
+ metadata.gz: 79931b2e41b024a2ae5503ff41321635959bfe3ea12ebdec92d565c03ef75072
4
+ data.tar.gz: f7247ded087e26ad540f22e3e306c8870c33c241e408f214c98839020acddccc
5
5
  SHA512:
6
- metadata.gz: cb9498e7a4bd0112e981732e136b2b6907fd34bc9c8bb645e41645c6074edcd891e95bee9919dc987bafdd4bd26969c07e6400884051375756dbb4524d83ba11
7
- data.tar.gz: 990927832f1a67b211f982c4a350997d2a2cb91b0d2a62d605b412547e835404145b5546271f4af9dd75af4582b64fb887529f380c1ee4980ac9e81330e581c6
6
+ metadata.gz: be36e288fa8892698c510b810580834445f75959511ea15b38fec4b079ca91235c920a27ed9ce6f69c6e05609d2b31db6c79cd0d888e59dde68eb7c74e849cf1
7
+ data.tar.gz: a2d892e60a65bd0f9a4b85d8994aeb26bf9b27d97a7397b8d6999aa408797d84f534d25d9d3a6c967def88c0ee0d313bc349dddd1f5b0a45224e65a656261c9b
data/README.md CHANGED
@@ -10,6 +10,8 @@
10
10
  # Experiment Ruby SDK
11
11
  Amplitude Ruby Server SDK for Experiment.
12
12
 
13
+ > ⚠️ **Local evaluation process fork safety:** When using a `LocalEvaluationClient` and forking the process, you must call `#start` _after forking_ to update the flag configuration state on the new process. For example, in Puma, this means calling `#start` in the [`on_worker_boot` hook](https://www.rubydoc.info/gems/puma/Puma%2FDSL:on_worker_boot).
14
+
13
15
  ## Installation
14
16
  Into Gemfile from rubygems.org:
15
17
  ```ruby
@@ -24,7 +26,6 @@ To install beta versions:
24
26
  gem install amplitude-experiment --pre
25
27
  ```
26
28
 
27
-
28
29
  ## Remote Evaluation Quick Start
29
30
  ```ruby
30
31
  require 'amplitude-experiment'
@@ -2,7 +2,6 @@
2
2
  module AmplitudeExperiment
3
3
  @local_instance = {}
4
4
  @remote_instance = {}
5
- @default_instance = '$default_instance'
6
5
 
7
6
  # Initializes a singleton Client. This method returns a default singleton instance, subsequent calls to
8
7
  # init will return the initial instance regardless of input.
@@ -10,10 +9,8 @@ module AmplitudeExperiment
10
9
  # @param [String] api_key The environment API Key
11
10
  # @param [Config] config Optional Config.
12
11
  def self.initialize_remote(api_key, config = nil)
13
- unless @local_instance.key?(@default_instance)
14
- @local_instance.store(@default_instance, RemoteEvaluationClient.new(api_key, config))
15
- end
16
- @local_instance.fetch(@default_instance)
12
+ @remote_instance.store(api_key, RemoteEvaluationClient.new(api_key, config)) unless @remote_instance.key?(api_key)
13
+ @remote_instance.fetch(api_key)
17
14
  end
18
15
 
19
16
  # Initializes a local evaluation Client. A local evaluation client can evaluate local flags or experiments for a
@@ -23,9 +20,7 @@ module AmplitudeExperiment
23
20
  # @param [String] api_key The environment API Key
24
21
  # @param [Config] config Optional Config.
25
22
  def self.initialize_local(api_key, config = nil)
26
- unless @remote_instance.key?(@default_instance)
27
- @remote_instance.store(@default_instance, LocalEvaluationClient.new(api_key, config))
28
- end
29
- @remote_instance.fetch(@default_instance)
23
+ @local_instance.store(api_key, LocalEvaluationClient.new(api_key, config)) unless @local_instance.key?(api_key)
24
+ @local_instance.fetch(api_key)
30
25
  end
31
26
  end
@@ -1,3 +1,3 @@
1
1
  module AmplitudeExperiment
2
- VERSION = '1.1.2'.freeze
2
+ VERSION = '1.1.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amplitude-experiment
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amplitude
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-10 00:00:00.000000000 Z
11
+ date: 2023-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: psych