mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-05-06 19:08:31 +00:00
Update dependencies.
This commit is contained in:
parent
0cf0a91699
commit
a402b487f8
662
Cargo.lock
generated
662
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
14
api/rust/Cargo.toml
vendored
14
api/rust/Cargo.toml
vendored
@ -15,17 +15,17 @@ json = ["pbjson", "pbjson-types", "serde"]
|
|||||||
internal = []
|
internal = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
prost = "0.11"
|
prost = "0.12"
|
||||||
prost-types = "0.11"
|
prost-types = "0.12"
|
||||||
hex = "0.4"
|
hex = "0.4"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
|
|
||||||
tonic = { version = "0.9", features = ["codegen", "prost"], default-features = false, optional = true }
|
tonic = { version = "0.10", features = ["codegen", "prost"], default-features = false, optional = true }
|
||||||
tokio = { version = "1.32", features = ["macros"], optional = true }
|
tokio = { version = "1.32", features = ["macros"], optional = true }
|
||||||
pbjson = { version = "0.5", optional = true }
|
pbjson = { version = "0.6", optional = true }
|
||||||
pbjson-types = { version = "0.5", optional = true }
|
pbjson-types = { version = "0.6", optional = true }
|
||||||
serde = { version = "1.0", optional = true }
|
serde = { version = "1.0", optional = true }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tonic-build = { version = "0.9", features = ["prost"], default-features = false }
|
tonic-build = { version = "0.10", features = ["prost"], default-features = false }
|
||||||
pbjson-build = "0.5"
|
pbjson-build = "0.6"
|
||||||
|
@ -34,7 +34,7 @@ diesel = { version = "2.1", features = [
|
|||||||
] }
|
] }
|
||||||
diesel_migrations = { version = "2.1" }
|
diesel_migrations = { version = "2.1" }
|
||||||
r2d2 = "0.8"
|
r2d2 = "0.8"
|
||||||
bigdecimal = "0.3"
|
bigdecimal = "0.4"
|
||||||
redis = { version = "0.23", features = ["r2d2", "cluster", "tls-rustls"] }
|
redis = { version = "0.23", features = ["r2d2", "cluster", "tls-rustls"] }
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
@ -72,14 +72,14 @@ tokio-reactor-trait = "1.1"
|
|||||||
rdkafka = { version = "0.34", default-features = false, features = ["tokio", "cmake-build"] }
|
rdkafka = { version = "0.34", default-features = false, features = ["tokio", "cmake-build"] }
|
||||||
|
|
||||||
# gRPC and Protobuf
|
# gRPC and Protobuf
|
||||||
tonic = "0.9"
|
tonic = "0.10"
|
||||||
tonic-web = "0.9"
|
tonic-web = "0.10"
|
||||||
tonic-reflection = "0.9"
|
tonic-reflection = "0.10"
|
||||||
tokio = { version = "1.32", features = ["macros", "rt-multi-thread"] }
|
tokio = { version = "1.32", features = ["macros", "rt-multi-thread"] }
|
||||||
tokio-stream = "0.1"
|
tokio-stream = "0.1"
|
||||||
prost-types = "0.11"
|
prost-types = "0.12"
|
||||||
prost = "0.11"
|
prost = "0.12"
|
||||||
pbjson-types = "0.5"
|
pbjson-types = "0.6"
|
||||||
|
|
||||||
# gRPC and HTTP multiplexing
|
# gRPC and HTTP multiplexing
|
||||||
warp = { version = "0.3", features = ["tls"], default-features = false }
|
warp = { version = "0.3", features = ["tls"], default-features = false }
|
||||||
|
@ -260,7 +260,7 @@ impl ToProto<common::DeviceClass> for DeviceClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn datetime_to_prost_timestamp(dt: &DateTime<Utc>) -> prost_types::Timestamp {
|
pub fn datetime_to_prost_timestamp(dt: &DateTime<Utc>) -> prost_types::Timestamp {
|
||||||
let ts = dt.timestamp_nanos();
|
let ts = dt.timestamp_nanos_opt().unwrap_or_default();
|
||||||
|
|
||||||
prost_types::Timestamp {
|
prost_types::Timestamp {
|
||||||
seconds: ts / 1_000_000_000,
|
seconds: ts / 1_000_000_000,
|
||||||
|
@ -1210,7 +1210,7 @@ impl Data {
|
|||||||
self.device_session.last_device_status_request = Some(Utc::now().into());
|
self.device_session.last_device_status_request = Some(Utc::now().into());
|
||||||
}
|
}
|
||||||
Some(ts) => {
|
Some(ts) => {
|
||||||
let ts: DateTime<Utc> = ts.clone().try_into()?;
|
let ts: DateTime<Utc> = ts.clone().try_into().map_err(anyhow::Error::msg)?;
|
||||||
let req_interval = Duration::from_secs(60 * 60 * 24)
|
let req_interval = Duration::from_secs(60 * 60 * 24)
|
||||||
/ self.device_profile.device_status_req_interval as u32;
|
/ self.device_profile.device_status_req_interval as u32;
|
||||||
|
|
||||||
@ -1563,7 +1563,8 @@ impl Data {
|
|||||||
|
|
||||||
match &rd.w_f_cnt_last_request {
|
match &rd.w_f_cnt_last_request {
|
||||||
Some(v) => {
|
Some(v) => {
|
||||||
let last_req: DateTime<Utc> = v.clone().try_into()?;
|
let last_req: DateTime<Utc> =
|
||||||
|
v.clone().try_into().map_err(anyhow::Error::msg)?;
|
||||||
if last_req
|
if last_req
|
||||||
< Utc::now()
|
< Utc::now()
|
||||||
.checked_sub_signed(chrono::Duration::hours(24))
|
.checked_sub_signed(chrono::Duration::hours(24))
|
||||||
|
@ -68,8 +68,8 @@ impl Integration {
|
|||||||
let client = aws_sdk_sns::Client::new(&config);
|
let client = aws_sdk_sns::Client::new(&config);
|
||||||
|
|
||||||
Ok(Integration {
|
Ok(Integration {
|
||||||
json: match Encoding::from_i32(conf.encoding)
|
json: match Encoding::try_from(conf.encoding)
|
||||||
.ok_or_else(|| anyhow!("Invalid encoding"))?
|
.map_err(|_| anyhow!("Invalid encoding"))?
|
||||||
{
|
{
|
||||||
Encoding::Json => true,
|
Encoding::Json => true,
|
||||||
Encoding::Protobuf => false,
|
Encoding::Protobuf => false,
|
||||||
|
@ -32,8 +32,8 @@ impl Integration {
|
|||||||
|
|
||||||
Ok(Integration {
|
Ok(Integration {
|
||||||
timeout: Duration::from_secs(5),
|
timeout: Duration::from_secs(5),
|
||||||
json: match Encoding::from_i32(conf.encoding)
|
json: match Encoding::try_from(conf.encoding)
|
||||||
.ok_or_else(|| anyhow!("Invalid encoding"))?
|
.map_err(|_| anyhow!("Invalid encoding"))?
|
||||||
{
|
{
|
||||||
Encoding::Json => true,
|
Encoding::Json => true,
|
||||||
Encoding::Protobuf => false,
|
Encoding::Protobuf => false,
|
||||||
|
@ -49,8 +49,8 @@ impl Integration {
|
|||||||
let auth_manager = AuthenticationManager::from(service_account);
|
let auth_manager = AuthenticationManager::from(service_account);
|
||||||
|
|
||||||
Ok(Integration {
|
Ok(Integration {
|
||||||
json: match Encoding::from_i32(conf.encoding)
|
json: match Encoding::try_from(conf.encoding)
|
||||||
.ok_or_else(|| anyhow!("Invalid encoding"))?
|
.map_err(|_| anyhow!("Invalid encoding"))?
|
||||||
{
|
{
|
||||||
Encoding::Json => true,
|
Encoding::Json => true,
|
||||||
Encoding::Protobuf => false,
|
Encoding::Protobuf => false,
|
||||||
|
@ -38,14 +38,14 @@ impl Integration {
|
|||||||
Ok(Integration {
|
Ok(Integration {
|
||||||
timeout: Duration::from_secs(5),
|
timeout: Duration::from_secs(5),
|
||||||
endpoint: conf.endpoint.clone(),
|
endpoint: conf.endpoint.clone(),
|
||||||
version: InfluxDbVersion::from_i32(conf.version)
|
version: InfluxDbVersion::try_from(conf.version)
|
||||||
.ok_or_else(|| anyhow!("Invalid version"))?,
|
.map_err(|_| anyhow!("Invalid version"))?,
|
||||||
db: conf.db.clone(),
|
db: conf.db.clone(),
|
||||||
username: conf.username.clone(),
|
username: conf.username.clone(),
|
||||||
password: conf.password.clone(),
|
password: conf.password.clone(),
|
||||||
retention_policy_name: conf.retention_policy_name.clone(),
|
retention_policy_name: conf.retention_policy_name.clone(),
|
||||||
precision: match InfluxDbPrecision::from_i32(conf.precision)
|
precision: match InfluxDbPrecision::try_from(conf.precision)
|
||||||
.ok_or_else(|| anyhow!("Invalid precision"))?
|
.map_err(|_| anyhow!("Invalid precision"))?
|
||||||
{
|
{
|
||||||
InfluxDbPrecision::Ns => "ns",
|
InfluxDbPrecision::Ns => "ns",
|
||||||
InfluxDbPrecision::U => "u",
|
InfluxDbPrecision::U => "u",
|
||||||
|
@ -43,7 +43,13 @@ impl Integration {
|
|||||||
let di = pl.device_info.as_ref().unwrap();
|
let di = pl.device_info.as_ref().unwrap();
|
||||||
|
|
||||||
info!(dev_eui = %di.dev_eui, "Forwarding join notification");
|
info!(dev_eui = %di.dev_eui, "Forwarding join notification");
|
||||||
let ts: DateTime<Utc> = pl.time.as_ref().unwrap().clone().try_into()?;
|
let ts: DateTime<Utc> = pl
|
||||||
|
.time
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.clone()
|
||||||
|
.try_into()
|
||||||
|
.map_err(anyhow::Error::msg)?;
|
||||||
let dev_eui = EUI64::from_str(&di.dev_eui)?;
|
let dev_eui = EUI64::from_str(&di.dev_eui)?;
|
||||||
|
|
||||||
let pl = client::UplinkRequest {
|
let pl = client::UplinkRequest {
|
||||||
@ -67,7 +73,13 @@ impl Integration {
|
|||||||
let di = pl.device_info.as_ref().unwrap();
|
let di = pl.device_info.as_ref().unwrap();
|
||||||
|
|
||||||
info!(dev_eui = %di.dev_eui, "Forwarding updf message");
|
info!(dev_eui = %di.dev_eui, "Forwarding updf message");
|
||||||
let ts: DateTime<Utc> = pl.time.as_ref().unwrap().clone().try_into()?;
|
let ts: DateTime<Utc> = pl
|
||||||
|
.time
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.clone()
|
||||||
|
.try_into()
|
||||||
|
.map_err(anyhow::Error::msg)?;
|
||||||
let dev_eui = EUI64::from_str(&di.dev_eui)?;
|
let dev_eui = EUI64::from_str(&di.dev_eui)?;
|
||||||
|
|
||||||
let req = client::UplinkRequest {
|
let req = client::UplinkRequest {
|
||||||
@ -137,7 +149,13 @@ impl Integration {
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let di = pl.device_info.as_ref().unwrap();
|
let di = pl.device_info.as_ref().unwrap();
|
||||||
info!(dev_eui = %di.dev_eui, "Forwarding uplink meta-data");
|
info!(dev_eui = %di.dev_eui, "Forwarding uplink meta-data");
|
||||||
let ts: DateTime<Utc> = pl.time.as_ref().unwrap().clone().try_into()?;
|
let ts: DateTime<Utc> = pl
|
||||||
|
.time
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.clone()
|
||||||
|
.try_into()
|
||||||
|
.map_err(anyhow::Error::msg)?;
|
||||||
let dev_eui = EUI64::from_str(&di.dev_eui)?;
|
let dev_eui = EUI64::from_str(&di.dev_eui)?;
|
||||||
|
|
||||||
let req = client::UplinkRequest {
|
let req = client::UplinkRequest {
|
||||||
@ -223,7 +241,13 @@ impl Integration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let di = pl.device_info.as_ref().unwrap();
|
let di = pl.device_info.as_ref().unwrap();
|
||||||
let ts: DateTime<Utc> = pl.time.as_ref().unwrap().clone().try_into()?;
|
let ts: DateTime<Utc> = pl
|
||||||
|
.time
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.clone()
|
||||||
|
.try_into()
|
||||||
|
.map_err(anyhow::Error::msg)?;
|
||||||
let dev_eui = EUI64::from_str(&di.dev_eui)?;
|
let dev_eui = EUI64::from_str(&di.dev_eui)?;
|
||||||
|
|
||||||
for p in &payloads {
|
for p in &payloads {
|
||||||
|
@ -227,7 +227,13 @@ impl IntegrationTrait for Integration {
|
|||||||
|
|
||||||
let e = EventUp {
|
let e = EventUp {
|
||||||
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
||||||
time: pl.time.as_ref().unwrap().clone().try_into()?,
|
time: pl
|
||||||
|
.time
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.clone()
|
||||||
|
.try_into()
|
||||||
|
.map_err(anyhow::Error::msg)?,
|
||||||
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
||||||
tenant_name: di.tenant_name.clone(),
|
tenant_name: di.tenant_name.clone(),
|
||||||
application_id: Uuid::from_str(&di.application_id)?,
|
application_id: Uuid::from_str(&di.application_id)?,
|
||||||
@ -271,7 +277,13 @@ impl IntegrationTrait for Integration {
|
|||||||
|
|
||||||
let e = EventJoin {
|
let e = EventJoin {
|
||||||
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
||||||
time: pl.time.as_ref().unwrap().clone().try_into()?,
|
time: pl
|
||||||
|
.time
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.clone()
|
||||||
|
.try_into()
|
||||||
|
.map_err(anyhow::Error::msg)?,
|
||||||
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
||||||
tenant_name: di.tenant_name.clone(),
|
tenant_name: di.tenant_name.clone(),
|
||||||
application_id: Uuid::from_str(&di.application_id)?,
|
application_id: Uuid::from_str(&di.application_id)?,
|
||||||
@ -307,7 +319,13 @@ impl IntegrationTrait for Integration {
|
|||||||
let e = EventAck {
|
let e = EventAck {
|
||||||
queue_item_id: Uuid::from_str(&pl.queue_item_id)?,
|
queue_item_id: Uuid::from_str(&pl.queue_item_id)?,
|
||||||
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
||||||
time: pl.time.as_ref().unwrap().clone().try_into()?,
|
time: pl
|
||||||
|
.time
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.clone()
|
||||||
|
.try_into()
|
||||||
|
.map_err(anyhow::Error::msg)?,
|
||||||
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
||||||
tenant_name: di.tenant_name.clone(),
|
tenant_name: di.tenant_name.clone(),
|
||||||
application_id: Uuid::from_str(&di.application_id)?,
|
application_id: Uuid::from_str(&di.application_id)?,
|
||||||
@ -344,7 +362,13 @@ impl IntegrationTrait for Integration {
|
|||||||
let e = EventTxAck {
|
let e = EventTxAck {
|
||||||
queue_item_id: Uuid::from_str(&pl.queue_item_id)?,
|
queue_item_id: Uuid::from_str(&pl.queue_item_id)?,
|
||||||
downlink_id: pl.downlink_id as i64,
|
downlink_id: pl.downlink_id as i64,
|
||||||
time: pl.time.as_ref().unwrap().clone().try_into()?,
|
time: pl
|
||||||
|
.time
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.clone()
|
||||||
|
.try_into()
|
||||||
|
.map_err(anyhow::Error::msg)?,
|
||||||
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
||||||
tenant_name: di.tenant_name.clone(),
|
tenant_name: di.tenant_name.clone(),
|
||||||
application_id: Uuid::from_str(&di.application_id)?,
|
application_id: Uuid::from_str(&di.application_id)?,
|
||||||
@ -380,7 +404,13 @@ impl IntegrationTrait for Integration {
|
|||||||
info!(dev_eui = %di.dev_eui, event = "log", "Inserting event");
|
info!(dev_eui = %di.dev_eui, event = "log", "Inserting event");
|
||||||
|
|
||||||
let e = EventLog {
|
let e = EventLog {
|
||||||
time: pl.time.as_ref().unwrap().clone().try_into()?,
|
time: pl
|
||||||
|
.time
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.clone()
|
||||||
|
.try_into()
|
||||||
|
.map_err(anyhow::Error::msg)?,
|
||||||
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
||||||
tenant_name: di.tenant_name.clone(),
|
tenant_name: di.tenant_name.clone(),
|
||||||
application_id: Uuid::from_str(&di.application_id)?,
|
application_id: Uuid::from_str(&di.application_id)?,
|
||||||
@ -418,7 +448,13 @@ impl IntegrationTrait for Integration {
|
|||||||
|
|
||||||
let e = EventStatus {
|
let e = EventStatus {
|
||||||
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
||||||
time: pl.time.as_ref().unwrap().clone().try_into()?,
|
time: pl
|
||||||
|
.time
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.clone()
|
||||||
|
.try_into()
|
||||||
|
.map_err(anyhow::Error::msg)?,
|
||||||
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
||||||
tenant_name: di.tenant_name.clone(),
|
tenant_name: di.tenant_name.clone(),
|
||||||
application_id: Uuid::from_str(&di.application_id)?,
|
application_id: Uuid::from_str(&di.application_id)?,
|
||||||
@ -456,7 +492,13 @@ impl IntegrationTrait for Integration {
|
|||||||
|
|
||||||
let e = EventLocation {
|
let e = EventLocation {
|
||||||
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
||||||
time: pl.time.as_ref().unwrap().clone().try_into()?,
|
time: pl
|
||||||
|
.time
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.clone()
|
||||||
|
.try_into()
|
||||||
|
.map_err(anyhow::Error::msg)?,
|
||||||
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
||||||
tenant_name: di.tenant_name.clone(),
|
tenant_name: di.tenant_name.clone(),
|
||||||
application_id: Uuid::from_str(&di.application_id)?,
|
application_id: Uuid::from_str(&di.application_id)?,
|
||||||
@ -495,7 +537,13 @@ impl IntegrationTrait for Integration {
|
|||||||
|
|
||||||
let e = EventIntegration {
|
let e = EventIntegration {
|
||||||
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
||||||
time: pl.time.as_ref().unwrap().clone().try_into()?,
|
time: pl
|
||||||
|
.time
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.clone()
|
||||||
|
.try_into()
|
||||||
|
.map_err(anyhow::Error::msg)?,
|
||||||
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
||||||
tenant_name: di.tenant_name.clone(),
|
tenant_name: di.tenant_name.clone(),
|
||||||
application_id: Uuid::from_str(&di.application_id)?,
|
application_id: Uuid::from_str(&di.application_id)?,
|
||||||
|
@ -24,7 +24,7 @@ pub async fn save(ds: &internal::PassiveRoamingDeviceSession) -> Result<()> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let lifetime: DateTime<Utc> = match ds.lifetime.clone() {
|
let lifetime: DateTime<Utc> = match ds.lifetime.clone() {
|
||||||
Some(v) => v.try_into()?,
|
Some(v) => v.try_into().map_err(anyhow::Error::msg)?,
|
||||||
None => {
|
None => {
|
||||||
debug!("Not saving passive-roaming device-session, no passive-roaming lifetime set");
|
debug!("Not saving passive-roaming device-session, no passive-roaming lifetime set");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
@ -1027,7 +1027,8 @@ impl Data {
|
|||||||
let record = metrics::Record {
|
let record = metrics::Record {
|
||||||
time: DateTime::<Utc>::try_from(
|
time: DateTime::<Utc>::try_from(
|
||||||
up_event.time.as_ref().unwrap().clone(),
|
up_event.time.as_ref().unwrap().clone(),
|
||||||
)?
|
)
|
||||||
|
.map_err(anyhow::Error::msg)?
|
||||||
.with_timezone(&Local),
|
.with_timezone(&Local),
|
||||||
kind: match dp_m.kind {
|
kind: match dp_m.kind {
|
||||||
fields::MeasurementKind::COUNTER => metrics::Kind::COUNTER,
|
fields::MeasurementKind::COUNTER => metrics::Kind::COUNTER,
|
||||||
|
@ -69,8 +69,7 @@ pub fn get_rx_timestamp(rx_info: &[gw::UplinkRxInfo]) -> SystemTime {
|
|||||||
// Then search for time.
|
// Then search for time.
|
||||||
for rxi in rx_info {
|
for rxi in rx_info {
|
||||||
if let Some(ts) = &rxi.time {
|
if let Some(ts) = &rxi.time {
|
||||||
let ts: core::result::Result<DateTime<Utc>, core::num::TryFromIntError> =
|
let ts: Result<DateTime<Utc>> = ts.clone().try_into().map_err(anyhow::Error::msg);
|
||||||
ts.clone().try_into();
|
|
||||||
if let Ok(ts) = ts {
|
if let Ok(ts) = ts {
|
||||||
return ts.into();
|
return ts.into();
|
||||||
}
|
}
|
||||||
@ -97,8 +96,7 @@ pub fn get_rx_timestamp_chrono(rx_info: &[gw::UplinkRxInfo]) -> DateTime<Utc> {
|
|||||||
// Then search for time.
|
// Then search for time.
|
||||||
for rxi in rx_info {
|
for rxi in rx_info {
|
||||||
if let Some(ts) = &rxi.time {
|
if let Some(ts) = &rxi.time {
|
||||||
let ts: core::result::Result<DateTime<Utc>, core::num::TryFromIntError> =
|
let ts: Result<DateTime<Utc>> = ts.clone().try_into().map_err(anyhow::Error::msg);
|
||||||
ts.clone().try_into();
|
|
||||||
if let Ok(ts) = ts {
|
if let Ok(ts) = ts {
|
||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,9 @@ impl Stats {
|
|||||||
|
|
||||||
let mut m = metrics::Record {
|
let mut m = metrics::Record {
|
||||||
time: match &self.stats.time {
|
time: match &self.stats.time {
|
||||||
Some(v) => DateTime::try_from(v.clone())?.into(),
|
Some(v) => DateTime::try_from(v.clone())
|
||||||
|
.map_err(anyhow::Error::msg)?
|
||||||
|
.into(),
|
||||||
None => Local::now(),
|
None => Local::now(),
|
||||||
},
|
},
|
||||||
kind: metrics::Kind::ABSOLUTE,
|
kind: metrics::Kind::ABSOLUTE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user