fix: harden service websocket reconnect flows
Stabilize the service console and callback-host websocket paths so idle disconnects and mid-task client drops no longer wedge task execution or spam repeated commands. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -162,6 +162,7 @@ fn start_callback_host_hotlist_browser_server(
|
||||
.to_string();
|
||||
let helper_client = Client::builder()
|
||||
.timeout(Duration::from_secs(2))
|
||||
.pool_max_idle_per_host(0)
|
||||
.build()
|
||||
.unwrap();
|
||||
let helper_html = helper_client
|
||||
@@ -213,14 +214,18 @@ fn start_callback_host_hotlist_browser_server(
|
||||
let mut saw_eval = false;
|
||||
|
||||
while Instant::now() < deadline {
|
||||
let envelope: Value = helper_client
|
||||
let envelope: Value = match helper_client
|
||||
.get(format!("{helper_origin}/sgclaw/callback/commands/next"))
|
||||
.send()
|
||||
.unwrap()
|
||||
.error_for_status()
|
||||
.unwrap()
|
||||
.json()
|
||||
.unwrap();
|
||||
.and_then(|response| response.error_for_status())
|
||||
.and_then(|response| response.json())
|
||||
{
|
||||
Ok(envelope) => envelope,
|
||||
Err(_) => {
|
||||
thread::sleep(Duration::from_millis(20));
|
||||
continue;
|
||||
}
|
||||
};
|
||||
let Some(command) = envelope.get("command").and_then(Value::as_object) else {
|
||||
thread::sleep(Duration::from_millis(20));
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user