MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / wait_for_pairing_target

Function wait_for_pairing_target

packages/server/src/main.rs:2233–2246  ·  view source on GitHub ↗
(target: &PairingTarget, timeout: Duration)

Source from the content-addressed store, hash-verified

2231}
2232
2233fn wait_for_pairing_target(target: &PairingTarget, timeout: Duration) -> anyhow::Result<()> {
2234 let deadline = Instant::now() + timeout;
2235 while Instant::now() < deadline {
2236 if http_get_json(&target.http_url, "/api/health").is_ok() {
2237 return Ok(());
2238 }
2239 std::thread::sleep(Duration::from_millis(50));
2240 }
2241 anyhow::bail!(
2242 "Timed out waiting for SimDeck {} at {}",
2243 target.target,
2244 target.http_url
2245 )
2246}
2247
2248fn service_is_healthy(metadata: &ServiceMetadata) -> bool {
2249 http_get_json(&metadata.http_url, "/api/health").is_ok()

Callers 1

pair_global_serviceFunction · 0.85

Calls 2

http_get_jsonFunction · 0.85
sleepFunction · 0.50

Tested by

no test coverage detected