Skip to content

Commit 2c851c7

Browse files
author
sebo
committed
feat: disable event track in config
1 parent 1cd109b commit 2c851c7

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
edition = "2021"
33
name = "feature-probe-server-sdk"
4-
version = "2.3.1"
4+
version = "2.3.2"
55
license = "Apache-2.0"
66
authors = ["[email protected]"]
77
description = "FeatureProbe Server Side SDK for Rust"

src/config.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub struct FPConfig {
1818
pub realtime_url: Option<Url>,
1919
#[cfg(feature = "realtime")]
2020
pub realtime_path: Option<String>,
21+
pub track_events: bool,
2122
}
2223

2324
#[derive(Debug, Clone)]
@@ -28,6 +29,7 @@ pub(crate) struct Config {
2829
pub refresh_interval: Duration,
2930
pub http_client: Option<Client>,
3031
pub start_wait: Option<Duration>,
32+
pub track_events: bool,
3133

3234
#[cfg(feature = "realtime")]
3335
pub realtime_url: Url,
@@ -51,6 +53,7 @@ impl Default for FPConfig {
5153
realtime_url: None,
5254
#[cfg(feature = "realtime")]
5355
realtime_path: None,
56+
track_events: true,
5457
}
5558
}
5659
}
@@ -62,6 +65,7 @@ impl Default for Config {
6265
toggles_url: Url::parse("https://featureprobe.io/server/api/server-sdk/toggles")
6366
.unwrap(),
6467
events_url: Url::parse("https://featureprobe.io/server/api/events").unwrap(),
68+
track_events: true,
6569
refresh_interval: Duration::from_secs(60),
6670
start_wait: None,
6771
http_client: None,
@@ -114,6 +118,7 @@ impl FPConfig {
114118
refresh_interval: self.refresh_interval,
115119
start_wait: self.start_wait,
116120
http_client: self.http_client.clone(),
121+
track_events: self.track_events,
117122
#[cfg(feature = "realtime")]
118123
realtime_url,
119124
#[cfg(feature = "realtime")]

src/feature_probe.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,9 @@ impl FeatureProbe {
252252
#[cfg(feature = "realtime")]
253253
self.connect_socket();
254254

255-
self.flush_events();
255+
if self.config.track_events {
256+
self.flush_events();
257+
}
256258
}
257259

258260
fn sync(&mut self) {

0 commit comments

Comments
 (0)