failed requests - retry until timeout
This commit is contained in:
parent
ff78898683
commit
5b905129d3
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1155,7 +1155,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "homekit-controller"
|
name = "homekit-controller"
|
||||||
version = "0.6.2"
|
version = "0.6.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chacha20poly1305",
|
"chacha20poly1305",
|
||||||
"ed25519-dalek",
|
"ed25519-dalek",
|
||||||
|
@ -1178,7 +1178,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "homekit-exporter"
|
name = "homekit-exporter"
|
||||||
version = "0.6.2"
|
version = "0.6.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "homekit-controller"
|
name = "homekit-controller"
|
||||||
version = "0.6.2"
|
version = "0.6.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
description = "Partial implementation of the HomeKit controller protocol"
|
description = "Partial implementation of the HomeKit controller protocol"
|
||||||
|
|
|
@ -306,22 +306,30 @@ impl DeviceConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn update_characteristics(&mut self) -> Result<(), HomekitError> {
|
pub async fn update_characteristics(&mut self) -> Result<(), HomekitError> {
|
||||||
match tokio::time::timeout(
|
match tokio::time::timeout(Duration::from_secs(METRIC_GATHER_TIMEOUT_SECS), async {
|
||||||
Duration::from_secs(METRIC_GATHER_TIMEOUT_SECS),
|
loop {
|
||||||
self.characteristics_request(true),
|
match self.characteristics_request(true).await {
|
||||||
)
|
Ok(_) => return,
|
||||||
|
Err(e) => {
|
||||||
|
log::warn!(
|
||||||
|
"{}failed to update characteristics: {e:?}",
|
||||||
|
formatted_name(&self.name)
|
||||||
|
);
|
||||||
|
self.socket = None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
.await
|
.await
|
||||||
.map_err(|_| HomekitError::Timeout)
|
|
||||||
.flatten_result()
|
|
||||||
{
|
{
|
||||||
Ok(r) => Ok(r),
|
Ok(r) => Ok(r),
|
||||||
Err(e) => {
|
Err(_) => {
|
||||||
log::warn!(
|
log::warn!(
|
||||||
"{}failed to update characteristics: {e:?}",
|
"{}timed out updating characteristics",
|
||||||
formatted_name(&self.name)
|
formatted_name(&self.name)
|
||||||
);
|
);
|
||||||
self.socket = None;
|
self.socket = None;
|
||||||
Err(e)
|
Err(HomekitError::Timeout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "homekit-exporter"
|
name = "homekit-exporter"
|
||||||
version = "0.6.2"
|
version = "0.6.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
description = "Prometheus exporter for HomeKit sensors"
|
description = "Prometheus exporter for HomeKit sensors"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Maintainer: Alex Janka <alex@alexjanka.com>
|
# Maintainer: Alex Janka <alex@alexjanka.com>
|
||||||
|
|
||||||
pkgname=homekit-logger
|
pkgname=homekit-logger
|
||||||
pkgver=0.6.2
|
pkgver=0.6.3
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Prometheus exporter for HomeKit sensors"
|
pkgdesc="Prometheus exporter for HomeKit sensors"
|
||||||
arch=('x86_64' 'aarch64')
|
arch=('x86_64' 'aarch64')
|
||||||
|
|
Loading…
Reference in a new issue