feat: 调整 AI 规格解析等待时间 (#286)

This commit is contained in:
chengma
2026-08-21 10:31:17 +08:00
parent 7d9d83d2fa
commit dc808e2a95
6 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ const (
MaxPurchaseSpecResolutionBodyBytes = 64 << 10
PurchaseSpecRulesVersion = "purchase_rules_v1"
purchaseSpecSchemaVersion = 1
purchaseSpecResolutionAITimeout = 30 * time.Second
purchaseSpecResolutionAITimeout = 66 * time.Second
)
var (
@@ -132,7 +132,7 @@ func (client *stubAIModelClient) Match(ctx context.Context, _ model.AIProviderCo
return client.response, client.err
}
func TestMatchPurchaseSpecWithRuntimeAI_限制30秒并继承更早取消(t *testing.T) {
func TestMatchPurchaseSpecWithRuntimeAI_限制66秒并继承更早取消(t *testing.T) {
req, _, _ := validRuntimeSpecRequest(t, "cg257-timeout", "L码", "M码", "XL码")
client := &runtimeDeadlineAIClient{}
loader := func(context.Context, *sql.DB, AISecretStore, AIEndpointPolicy) (AIMatchSnapshot, error) {
@@ -151,7 +151,7 @@ func TestMatchPurchaseSpecWithRuntimeAI_限制30秒并继承更早取消(t *test
t.Fatal("运行时 AI 上下文缺少截止时间")
}
budget := client.deadline.Sub(startedAt)
if budget < 29*time.Second || budget > purchaseSpecResolutionAITimeout {
if budget < 65*time.Second || budget > purchaseSpecResolutionAITimeout {
t.Fatalf("运行时 AI 时间预算=%s,期望不超过 %s", budget, purchaseSpecResolutionAITimeout)
}