diff --git a/configs/config.toml b/configs/config.toml index 81b51c3a0..64c8cefe4 100644 --- a/configs/config.toml +++ b/configs/config.toml @@ -77,7 +77,7 @@ blacklist = ["cancollector_metrics", "candump_metrics", "pinger"] # it as non-persistent. streams are internally constructed as a map of Name -> Config [streams.device_shadow] topic = "/tenants/{tenant_id}/devices/{device_id}/events/device_shadow/jsonarray" -buf_size = 1 +flush_period = 5 # Example using compression [streams.imu] @@ -119,7 +119,7 @@ persistence = { max_file_count = 3 } # This also means that we require a topic to be configured or uplink will error out. [action_status] topic = "/tenants/{tenant_id}/devices/{device_id}/action/status" -buf_size = 1 +flush_period = 2 # Configurations for uplink's built-in file downloader, including the actions that can trigger # a download, the location in file system where uplink will download and store files from the diff --git a/uplink/src/base/mod.rs b/uplink/src/base/mod.rs index 716baf3ad..d2ae97ac7 100644 --- a/uplink/src/base/mod.rs +++ b/uplink/src/base/mod.rs @@ -24,6 +24,11 @@ fn default_timeout() -> u64 { DEFAULT_TIMEOUT } +#[inline] +fn max_buf_size() -> usize { + MAX_BUFFER_SIZE +} + fn default_file_size() -> usize { 10485760 // 10MB } @@ -46,6 +51,7 @@ pub enum Compression { #[derive(Debug, Clone, Deserialize)] pub struct StreamConfig { pub topic: String, + #[serde(default = "max_buf_size")] pub buf_size: usize, #[serde(default = "default_timeout")] /// Duration(in seconds) that bridge collector waits from diff --git a/uplink/src/lib.rs b/uplink/src/lib.rs index 19cb128ae..b06b226ee 100644 --- a/uplink/src/lib.rs +++ b/uplink/src/lib.rs @@ -129,12 +129,11 @@ pub mod config { [action_status] topic = "/tenants/{tenant_id}/devices/{device_id}/action/status" - buf_size = 1 - timeout = 10 + flush_period = 2 [streams.device_shadow] topic = "/tenants/{tenant_id}/devices/{device_id}/events/device_shadow/jsonarray" - buf_size = 1 + flush_period = 5 [streams.logs] topic = "/tenants/{tenant_id}/devices/{device_id}/events/logs/jsonarray"