Skip to content

Commit c0e8416

Browse files
committed
fix: Corrected discovery retry uptime limit to be 1 minute instead of 1 second
1 parent 0a63d4b commit c0e8416

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
- [main] Fixed `--volume-ctrl fixed` not disabling volume control
1717
- [core] Fix default permissions on credentials file and warn user if file is world readable
1818
- [core] Try all resolved addresses for the dealer connection instead of failing after the first one.
19+
- [core] Corrected discovery retry uptime limit to be 1 minute instead of 1 second
1920

2021
## [0.8.0] - 2025-11-10
2122

src/main.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,6 +1883,7 @@ async fn main() {
18831883
const RUST_BACKTRACE: &str = "RUST_BACKTRACE";
18841884
const RECONNECT_RATE_LIMIT_WINDOW: Duration = Duration::from_secs(600);
18851885
const DISCOVERY_RETRY_TIMEOUT: Duration = Duration::from_secs(10);
1886+
const DISCOVERY_RETRY_UPTIME_LIMIT: Duration = Duration::from_secs(60);
18861887
const RECONNECT_RATE_LIMIT: usize = 5;
18871888

18881889
if env::var(RUST_BACKTRACE).is_err() {
@@ -1910,8 +1911,8 @@ async fn main() {
19101911
// network-online.target but it requires that a wait-online.service is
19111912
// also enabled which is not always the case since a wait-online.service
19121913
// can potentially hang the boot process until it times out in certain situations.
1913-
// This allows for discovery to retry every 10 secs in the 1st min of uptime
1914-
// before giving up thus papering over the issue and not holding up the boot process.
1914+
// This allows for discovery to do periodic retries for an amount of time after system
1915+
// startup before giving up thus papering over the issue and not holding up the boot process.
19151916

19161917
discovery = loop {
19171918
let device_id = setup.session_config.device_id.clone();
@@ -1930,11 +1931,14 @@ async fn main() {
19301931
Err(e) => {
19311932
sys.refresh_processes(ProcessesToUpdate::All, true);
19321933

1933-
if System::uptime() <= 1 {
1934+
if Duration::from_secs(System::uptime()) <= DISCOVERY_RETRY_UPTIME_LIMIT {
19341935
debug!("Retrying to initialise discovery: {e}");
19351936
tokio::time::sleep(DISCOVERY_RETRY_TIMEOUT).await;
19361937
} else {
1937-
debug!("System uptime > 1 min, not retrying to initialise discovery");
1938+
debug!(
1939+
"System uptime > {} secs, not retrying to initialise discovery",
1940+
DISCOVERY_RETRY_UPTIME_LIMIT.as_secs()
1941+
);
19381942
warn!("Could not initialise discovery: {e}");
19391943
break None;
19401944
}

0 commit comments

Comments
 (0)