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