fix(workbench): keep read retries within web budget (#1921)

This commit is contained in:
Lyon
2026-06-22 20:56:53 +08:00
committed by GitHub
parent a0b3d310d3
commit ce426893cd
3 changed files with 29 additions and 5 deletions
+10
View File
@@ -392,6 +392,7 @@
"type": "object",
"properties": {
"client": { "$ref": "#/$defs/workbenchRuntimeClient" },
"factsQuery": { "$ref": "#/$defs/workbenchRuntimeFactsQuery" },
"postgres": { "$ref": "#/$defs/workbenchRuntimePostgres" },
"cache": { "$ref": "#/$defs/workbenchRuntimeCache" }
},
@@ -404,6 +405,15 @@
},
"additionalProperties": false
},
"workbenchRuntimeFactsQuery": {
"type": "object",
"properties": {
"maxAttempts": { "type": "integer", "minimum": 1 },
"backoffBaseMs": { "type": "integer", "minimum": 0 },
"backoffMaxMs": { "type": "integer", "minimum": 1 }
},
"additionalProperties": false
},
"workbenchRuntimePostgres": {
"type": "object",
"properties": {
+6 -5
View File
@@ -308,10 +308,14 @@ lanes:
queryRetryMaxDelayMs: 5000
workbenchRuntime:
client:
timeoutMs: 4500
timeoutMs: 3000
factsQuery:
maxAttempts: 1
backoffBaseMs: 0
backoffMaxMs: 1
postgres:
poolMax: 4
queryTimeoutMs: 4500
queryTimeoutMs: 3000
readyTimeoutMs: 2000
cache:
redis:
@@ -563,9 +567,6 @@ lanes:
HWLAB_BOOTSTRAP_ADMIN_API_KEY: secretRef:hwlab-v03-master-server-admin-api-key/api-key
HWLAB_USER_BILLING_URL: http://hwlab-user-billing.hwlab-v03.svc.cluster.local:6670
HWLAB_WORKBENCH_RUNTIME_URL: http://hwlab-workbench-runtime.hwlab-v03.svc.cluster.local:6671
HWLAB_WORKBENCH_FACTS_QUERY_MAX_ATTEMPTS: "2"
HWLAB_WORKBENCH_FACTS_QUERY_BACKOFF_BASE_MS: "120"
HWLAB_WORKBENCH_FACTS_QUERY_BACKOFF_MAX_MS: "250"
HWLAB_USER_BILLING_LOGIN_RETRY_ATTEMPTS: "2"
HWLAB_USER_BILLING_LOGIN_RETRY_DELAY_MS: "250"
HWLAB_USER_BILLING_CODE_AGENT_ENABLED: "1"
+13
View File
@@ -940,6 +940,7 @@ function deployServicesForProfile(deploy, profile) {
serviceDeclarationEnvForProfile(deploy, profile, service.serviceId),
runtimeStoreEnvForProfile(deploy, profile, service.serviceId),
workbenchRuntimeClientEnvForProfile(deploy, profile, service.serviceId),
workbenchRuntimeFactsQueryEnvForProfile(deploy, profile, service.serviceId),
workbenchRuntimePostgresEnvForProfile(deploy, profile, service.serviceId),
workbenchRuntimeRedisEnvForProfile(deploy, profile, service.serviceId)
);
@@ -955,6 +956,7 @@ function deployServicesForProfile(deploy, profile) {
serviceDeclarationEnvForProfile(deploy, profile, override.serviceId),
runtimeStoreEnvForProfile(deploy, profile, override.serviceId),
workbenchRuntimeClientEnvForProfile(deploy, profile, override.serviceId),
workbenchRuntimeFactsQueryEnvForProfile(deploy, profile, override.serviceId),
workbenchRuntimePostgresEnvForProfile(deploy, profile, override.serviceId),
workbenchRuntimeRedisEnvForProfile(deploy, profile, override.serviceId)
)
@@ -1062,6 +1064,17 @@ function workbenchRuntimeClientEnvForProfile(deploy, profile, serviceId) {
return env;
}
function workbenchRuntimeFactsQueryEnvForProfile(deploy, profile, serviceId) {
if (!isRuntimeLane(profile) || serviceId !== "hwlab-cloud-api") return {};
const factsQuery = runtimeLaneConfig(deploy, profile)?.workbenchRuntime?.factsQuery;
if (!factsQuery || typeof factsQuery !== "object" || Array.isArray(factsQuery)) return {};
const env = {};
if (Number.isInteger(factsQuery.maxAttempts)) env.HWLAB_WORKBENCH_FACTS_QUERY_MAX_ATTEMPTS = String(factsQuery.maxAttempts);
if (Number.isInteger(factsQuery.backoffBaseMs)) env.HWLAB_WORKBENCH_FACTS_QUERY_BACKOFF_BASE_MS = String(factsQuery.backoffBaseMs);
if (Number.isInteger(factsQuery.backoffMaxMs)) env.HWLAB_WORKBENCH_FACTS_QUERY_BACKOFF_MAX_MS = String(factsQuery.backoffMaxMs);
return env;
}
function workbenchRuntimePostgresEnvForProfile(deploy, profile, serviceId) {
if (!isRuntimeLane(profile) || serviceId !== "hwlab-workbench-runtime") return {};
const postgres = runtimeLaneConfig(deploy, profile)?.workbenchRuntime?.postgres;