修复: 审批挂起关不了(None分支补emit+恢复对账) + obscura检测区分未装/失败(防误弹)
This commit is contained in:
@@ -248,7 +248,7 @@ async fn fetch_with_obscura(url_raw: &str, max_length: usize) -> anyhow::Result<
|
||||
None => {
|
||||
// 未装:回退静态 + hint。
|
||||
let mut fallback = fetch_static(url_raw, max_length, DEFAULT_TIMEOUT_SECS, &Value::Null).await?;
|
||||
fallback["render_mode"] = json!("static_fallback");
|
||||
fallback["render_mode"] = json!("obscura_not_installed");
|
||||
fallback["hint"] = json!(OBSCURA_HINT);
|
||||
fallback["elapsed_ms"] = json!(started.elapsed().as_millis() as u64);
|
||||
return Ok(fallback);
|
||||
@@ -277,7 +277,7 @@ async fn fetch_with_obscura(url_raw: &str, max_length: usize) -> anyhow::Result<
|
||||
Ok(Err(e)) => {
|
||||
tracing::warn!("obscura spawn 失败({}),回退静态", e);
|
||||
let mut fallback = fetch_static(url_raw, max_length, DEFAULT_TIMEOUT_SECS, &Value::Null).await?;
|
||||
fallback["render_mode"] = json!("static_fallback");
|
||||
fallback["render_mode"] = json!("obscura_failed");
|
||||
fallback["hint"] = json!(format!("obscura 启动失败({}),已用静态模式。{}", e, OBSCURA_HINT));
|
||||
fallback["elapsed_ms"] = json!(started.elapsed().as_millis() as u64);
|
||||
return Ok(fallback);
|
||||
@@ -285,7 +285,7 @@ async fn fetch_with_obscura(url_raw: &str, max_length: usize) -> anyhow::Result<
|
||||
Err(_) => {
|
||||
tracing::warn!("obscura 超时({}s),回退静态", OBSCURA_TIMEOUT_SECS);
|
||||
let mut fallback = fetch_static(url_raw, max_length, DEFAULT_TIMEOUT_SECS, &Value::Null).await?;
|
||||
fallback["render_mode"] = json!("static_fallback");
|
||||
fallback["render_mode"] = json!("obscura_failed");
|
||||
fallback["hint"] = json!(format!("obscura 渲染超时({}s),已用静态模式。{}", OBSCURA_TIMEOUT_SECS, OBSCURA_HINT));
|
||||
fallback["elapsed_ms"] = json!(started.elapsed().as_millis() as u64);
|
||||
return Ok(fallback);
|
||||
@@ -362,7 +362,7 @@ fn find_obscura() -> Option<String> {
|
||||
let out = c.output();
|
||||
let _ = tx.send(out);
|
||||
});
|
||||
match rx.recv_timeout(Duration::from_secs(5)) {
|
||||
match rx.recv_timeout(Duration::from_secs(15)) {
|
||||
Ok(Ok(o)) if o.status.success() => return Some(cand.to_string()),
|
||||
_ => continue,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user