Repository navigation
fix(backend): increase default ping timeout - #207
Merged
zouyonghe merged 2 commits intoDec 3, 2026
Merged
Conversation
Linked issuesChecked at commit 173b1c3 #203 [Bug] 更新4.30.0桌面版无法打开 · 0 of 1 met · 1 to check by hand
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src-tauri/src/app_constants.rs" line_range="40" />
<code_context>
pub(crate) const DEFAULT_BACKEND_STARTUP_HEARTBEAT_RELATIVE_PATH: &str =
"data/backend-startup-heartbeat.json";
-pub(crate) const DEFAULT_BACKEND_PING_TIMEOUT_MS: u64 = 800;
+pub(crate) const DEFAULT_BACKEND_PING_TIMEOUT_MS: u64 = 5_000;
pub(crate) const BACKEND_PING_TIMEOUT_MIN_MS: u64 = 50;
pub(crate) const BACKEND_PING_TIMEOUT_MAX_MS: u64 = 30_000;
</code_context>
<issue_to_address>
**Multi-address probes exceed timeout**
When `ASTRBOT_BACKEND_URL` resolves to multiple addresses and earlier addresses take their full connect timeout to fail, `ping_backend` applies the timeout separately to each resolved address, so unreachable addresses can consume five seconds apiece before it reaches a later working address or returns false; managed-backend startup is delayed well beyond the documented ping timeout.
Use one deadline for the whole address probe and pass each connection attempt only the remaining time.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: src-tauri/src/app_constants.rs:40
This was referenced Dec 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #203.
Problem
The managed-backend start preflight added in #191 uses
ASTRBOT_BACKEND_PING_TIMEOUT_MSto confirm that the configured endpoint is free. Its default is 800 ms. On Windows, a connection to a closed loopback port can take about two seconds to report refusal, so the preflight times out as inconclusive and blocks the backend spawn. The reportedASTRBOT_BACKEND_PING_TIMEOUT_MS=5000override allows startup.Change
PR #204 is also open for this startup failure. It uses a probe-specific 3000 ms minimum, while this change follows the reported 5000 ms override by increasing the shared default.
Validation
cargo fmt --manifest-path src-tauri/Cargo.toml --all -- --checkcargo clippy --manifest-path src-tauri/Cargo.toml --locked --all-targets -- -D warningscargo check --manifest-path src-tauri/Cargo.toml --lockedcargo test --manifest-path src-tauri/Cargo.toml --locked -- --nocapture— 288 passed on macOS.Native Windows runtime verification was not available in this environment.
Summary by Sourcery
Allow managed backends more time to respond to the startup availability check.
Bug Fixes:
Documentation:
Tests: