V10.576 修正 GCP-only Ollama retry
All checks were successful
CD Pipeline / deploy (push) Successful in 1m5s

This commit is contained in:
OoO
2026-06-04 11:20:52 +08:00
parent 58e8d5ee0f
commit 3b9448b776
6 changed files with 19 additions and 7 deletions

View File

@@ -638,9 +638,18 @@ class OllamaService:
for attempt in range(max_attempts):
current_host = _normalize_host(self.host) # property 每次 lazy resolve
if not allow_111_fallback and _is_111_fallback_host(current_host):
last_error = "111 fallback disabled; no approved GCP Ollama host available"
logger.warning("[Ollama] %s", last_error)
break
next_host = next((host for host in allowed_hosts if host not in attempted_hosts), None)
if not next_host:
last_error = "111 fallback disabled; no approved GCP Ollama host available"
logger.warning("[Ollama] %s", last_error)
break
logger.info(
"[Ollama] resolver selected 111 but caller disabled fallback; forcing approved GCP host=%s",
next_host,
)
if self._explicit_host is None:
_clear_resolved_host_cache()
current_host = next_host
if current_host in attempted_hosts:
# 已試過同主機時,若是標準三主機鏈且 caller 沒指定 host
# 改走尚未嘗試的下一台。避免 request timeout(60s) 大於