eppo-server-sdk 3.5.1 → 3.6.0

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: 8736dc91a90cc3bfcd7341761de970c6e6aedc5838945064cfc74be41b7e3104
4
- data.tar.gz: 9124f779092595e25273103af99bc04f4abafd6b8df4a0f1af971c01592a6f23
3
+ metadata.gz: 8f2e1f7ca83860dbbc56a5d64e62bc15b5776cc0655369159b8001337dfbcad0
4
+ data.tar.gz: 2bcf8184537c1e59e8cc69d00abb17454e559735ea3ed52dca21ee0f97d4d1f5
5
5
  SHA512:
6
- metadata.gz: 02ab023a78d693752224e6a122a89935c7ea2c43694fba2fe921d2693444448d545457cee3c465d314015c5b3cba4073f6441f2306ff5412a4ee256e1f2b51d6
7
- data.tar.gz: 9b9ce37027e9ff048663b60ad8162ef7e84a25ae0506a674c620ba9793ea63659a1ae9bd0576dbc2fb2d83960ccabd40888f55fa07c16fa086bd5ad474e45835
6
+ metadata.gz: 0720a57feec371ba621746f3e2398210a598b476863e93aa11beed4cabd73d016065f81fa8ac8a06bf978ba301569700ea71c6efd98414b95c9295c784d7e835
7
+ data.tar.gz: 8e8154d224f4bb90f9a795b34e728ca1ef46f2f038b4ca459a5c978200e2686b5870622621c162a59440d7f4b4cf00782836223ba2cde509bb581dc8a8df2d75
data/Cargo.lock CHANGED
@@ -335,7 +335,7 @@ dependencies = [
335
335
 
336
336
  [[package]]
337
337
  name = "eppo_client"
338
- version = "3.5.1"
338
+ version = "3.6.0"
339
339
  dependencies = [
340
340
  "env_logger",
341
341
  "eppo_core",
@@ -345,13 +345,14 @@ dependencies = [
345
345
  "serde",
346
346
  "serde_json",
347
347
  "serde_magnus",
348
+ "tokio",
348
349
  ]
349
350
 
350
351
  [[package]]
351
352
  name = "eppo_core"
352
- version = "9.1.0"
353
+ version = "9.1.1"
353
354
  source = "registry+https://github.com/rust-lang/crates.io-index"
354
- checksum = "228932170e61e7fcafc6ae6f7955cff96a60706c07d0be7809067b5d4ec6d61e"
355
+ checksum = "9efc3a3a7df69645e3a9541427dbca7aa37f9e1a648557537ffcb03327757b16"
355
356
  dependencies = [
356
357
  "base64",
357
358
  "chrono",
@@ -889,9 +890,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
889
890
 
890
891
  [[package]]
891
892
  name = "libc"
892
- version = "0.2.167"
893
+ version = "0.2.171"
893
894
  source = "registry+https://github.com/rust-lang/crates.io-index"
894
- checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc"
895
+ checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6"
895
896
 
896
897
  [[package]]
897
898
  name = "libloading"
@@ -1785,9 +1786,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
1785
1786
 
1786
1787
  [[package]]
1787
1788
  name = "tokio"
1788
- version = "1.41.1"
1789
+ version = "1.44.1"
1789
1790
  source = "registry+https://github.com/rust-lang/crates.io-index"
1790
- checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33"
1791
+ checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a"
1791
1792
  dependencies = [
1792
1793
  "backtrace",
1793
1794
  "bytes",
@@ -1801,9 +1802,9 @@ dependencies = [
1801
1802
 
1802
1803
  [[package]]
1803
1804
  name = "tokio-macros"
1804
- version = "2.4.0"
1805
+ version = "2.5.0"
1805
1806
  source = "registry+https://github.com/rust-lang/crates.io-index"
1806
- checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
1807
+ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
1807
1808
  dependencies = [
1808
1809
  "proc-macro2",
1809
1810
  "quote",
@@ -1,7 +1,7 @@
1
1
  [package]
2
2
  name = "eppo_client"
3
3
  # TODO: this version and lib/eppo_client/version.rb should be in sync
4
- version = "3.5.1"
4
+ version = "3.6.0"
5
5
  edition = "2021"
6
6
  license = "MIT"
7
7
  publish = false
@@ -12,10 +12,11 @@ crate-type = ["cdylib"]
12
12
 
13
13
  [dependencies]
14
14
  env_logger = { version = "0.11.3", features = ["unstable-kv"] }
15
- eppo_core = { version = "=9.1.0", features = ["magnus", "event_ingestion"] }
15
+ eppo_core = { version = "=9.1.1", features = ["magnus", "event_ingestion"] }
16
16
  log = { version = "0.4.21", features = ["kv_serde"] }
17
17
  magnus = { version = "0.7.1" }
18
18
  serde = { version = "1.0.203", features = ["derive"] }
19
19
  serde_magnus = "0.9.0"
20
20
  rb-sys = "0.9.102"
21
21
  serde_json = "1.0.128"
22
+ tokio = { version = "1.44.1", default-features = false, features = ["time"] }
@@ -238,6 +238,33 @@ impl Client {
238
238
  serde_magnus::serialize(&result)
239
239
  }
240
240
 
241
+ pub fn wait_for_initialization(&self, timeout_secs: f64) {
242
+ log::info!(target: "eppo", "waiting for initialization");
243
+ let thread = self.background_thread.borrow();
244
+ let Some(thread) = thread.as_ref() else {
245
+ log::warn!(target: "eppo", "failed to wait for initialization: background thread is not running");
246
+ return;
247
+ };
248
+ let Some(poller) = &self.configuration_poller else {
249
+ log::warn!(target: "eppo", "failed to wait for initialization: configuration poller has not been started");
250
+ return;
251
+ };
252
+
253
+ let _ = thread
254
+ .runtime()
255
+ .async_runtime
256
+ .block_on(async {
257
+ tokio::time::timeout(
258
+ Duration::from_secs_f64(timeout_secs),
259
+ poller.wait_for_configuration(),
260
+ )
261
+ .await
262
+ })
263
+ .inspect_err(|err| {
264
+ log::warn!(target: "eppo", "failed to wait for initialization: {err:?}");
265
+ });
266
+ }
267
+
241
268
  pub fn get_configuration(&self) -> Option<Configuration> {
242
269
  self.configuration_store
243
270
  .get_configuration()
@@ -29,6 +29,10 @@ fn init(ruby: &Ruby) -> Result<(), Error> {
29
29
  method!(Client::get_bandit_action_details, 5),
30
30
  )?;
31
31
  core_client.define_method("track", method!(Client::track, 2))?;
32
+ core_client.define_method(
33
+ "wait_for_initialization",
34
+ method!(Client::wait_for_initialization, 1),
35
+ )?;
32
36
  core_client.define_method("configuration", method!(Client::get_configuration, 0))?;
33
37
  core_client.define_method("configuration=", method!(Client::set_configuration, 1))?;
34
38
  core_client.define_method("shutdown", method!(Client::shutdown, 0))?;
@@ -31,6 +31,20 @@ module EppoClient
31
31
  @core = EppoClient::Core::Client.new(config)
32
32
  end
33
33
 
34
+ ##
35
+ # Waits for client to fetch configuration and get ready to serve
36
+ # assignments.
37
+ #
38
+ # This method blocks the current thread until configuration is
39
+ # successfully fetched or +timeout+ seconds passed.
40
+ #
41
+ # Note: this method returns immediately if configuration poller
42
+ # has been disabled.
43
+ def wait_for_initialization(timeout=1)
44
+ return unless @core
45
+ @core.wait_for_initialization(timeout)
46
+ end
47
+
34
48
  def configuration
35
49
  @core.configuration
36
50
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # TODO: this version and ext/eppo_client/Cargo.toml should be in sync
4
4
  module EppoClient
5
- VERSION = "3.5.1"
5
+ VERSION = "3.6.0"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eppo-server-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.1
4
+ version: 3.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eppo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-14 00:00:00.000000000 Z
11
+ date: 2025-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb_sys