fix(runner): 修复图像结果转存与任务租约失效
修正非语义字段长 Base64 元数据被误判为媒体的问题,并允许按文件签名识别真实媒体后转存 OSS;同时将网关本地存储失败与上游失败分离,避免重复调用和错误降权。 异步任务复用已分配并发名额前立即刷新租约,租约已丢失时重新排队获取,避免排队耗时侵蚀租约后错误调用上游。生产环境关闭 server-main 尚未实现的进度回调,保留 Gateway 任务详情与事件查询。 验证:API 全量 go test、go vet、gofmt、Kubernetes 渲染、迁移安全检查及真实阿里云 OSS 读写/生命周期验收通过。
This commit is contained in:
@@ -303,16 +303,16 @@ func priorityDemoteDecisionForCandidate(runnerPolicy store.RunnerPolicy, err err
|
||||
}
|
||||
|
||||
func isResultPersistenceFailure(err error) bool {
|
||||
switch strings.ToLower(strings.TrimSpace(clients.ErrorCode(err))) {
|
||||
case "local_result_storage_unavailable",
|
||||
"binary_result_too_large",
|
||||
"binary_result_corrupted",
|
||||
"binary_result_expired",
|
||||
"result_binary_not_materialized":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
return isGatewayResultPersistenceCode(clients.ErrorCode(err))
|
||||
}
|
||||
|
||||
func isGatewayResultPersistenceCode(code string) bool {
|
||||
code = strings.ToLower(strings.TrimSpace(code))
|
||||
return strings.HasPrefix(code, "storage_") ||
|
||||
strings.HasPrefix(code, "upload_") ||
|
||||
strings.HasPrefix(code, "binary_result_") ||
|
||||
strings.HasPrefix(code, "local_result_") ||
|
||||
strings.HasPrefix(code, "result_binary_")
|
||||
}
|
||||
|
||||
func effectiveFailoverPolicy(base map[string]any, override map[string]any) map[string]any {
|
||||
@@ -353,6 +353,8 @@ func failureCategory(code string, status int, message string) string {
|
||||
switch {
|
||||
case code == "insufficient_balance":
|
||||
return "insufficient_balance"
|
||||
case isGatewayResultPersistenceCode(code):
|
||||
return "gateway_storage"
|
||||
case code == "rate_limit" || status == 429:
|
||||
return "rate_limit"
|
||||
case code == "network":
|
||||
|
||||
Reference in New Issue
Block a user