修复 Stdb publish 事务确认超时被误判为失败
Project CI / AI game creator shell Rust crates (push) Successful in 3m0s
Project CI / AI game creator shell Rust smoke (push) Successful in 4m0s
Project CI / AI game creator shell Rust lane 1/2 (push) Failing after 7m41s
Project CI / AI game creator shell Rust lane 2/2 (push) Failing after 8m44s
Project CI / Backend tests (push) Successful in 8m52s
Project CI / Frontend tests (push) Has been cancelled
Project CI / Native shell tests (push) Has been cancelled
Project CI / AI game creator shell web tests (push) Has been cancelled
Project CI / Repository checks (push) Has been cancelled

- production-stdb-publish 新增 run_spacetime_publish:仅在出现 timeout waiting for transaction confirmation 时重试一次同版本 publish(SpacetimeDB 对已生效的同版本为幂等),重试成功即视为模块已在位,不再把生产留在维护态
- 其它失败原因保持原有失败关闭语义;生产运维门禁断言补上该重试口径
This commit is contained in:
2026-09-21 13:27:37 +08:00
parent 4ad131d74d
commit 2e31a485d8
2 changed files with 36 additions and 2 deletions
@@ -277,6 +277,12 @@ const checks = [
reason:
'archive 冷备份空间不足时必须能自动降级为 files 存储格式(不落地本地归档)。',
},
{
file: 'scripts/deploy/production-stdb-publish.sh',
includes: 'timeout waiting for transaction confirmation',
reason:
'publish 客户端等确认超时不能直接判失败:必须重试同版本 publish 以确认模块是否已生效,避免把生产留在维护态。',
},
{
file: 'scripts/deploy/production-stdb-publish.sh',
includes: 'restore_runtime_services_before_publish',
+30 -2
View File
@@ -904,6 +904,34 @@ else
echo "[production-stdb-publish] 发布 SpacetimeDB module: ${DATABASE} -> ${SERVER_ALIAS}, root=${SPACETIME_ROOT_DIR}"
fi
# 迁移已提交但客户端等确认超时(HTTP 504 / timeout waiting for transaction confirmation
# 时不能直接判失败:重试一次同版本 publish,SpacetimeDB 对已生效的同版本是幂等的 no-op,
# 重试成功即说明目标模块已在位,避免把生产留在维护态。
run_spacetime_publish() {
local attempt=1
local output=""
local status=0
while :; do
output=""
status=0
if [[ -n "${RUN_AS_USER}" && "$(id -u)" -eq 0 ]]; then
output="$(runuser -u "${RUN_AS_USER}" -- spacetime "${PUBLISH_ARGS[@]}" 2>&1)" || status=$?
else
output="$(spacetime "${PUBLISH_ARGS[@]}" 2>&1)" || status=$?
fi
printf '%s\n' "${output}"
if [[ "${status}" -eq 0 ]]; then
return 0
fi
if [[ "${attempt}" -ge 2 || "${output}" != *"timeout waiting for transaction confirmation"* ]]; then
return "${status}"
fi
echo "[production-stdb-publish] publish 客户端等事务确认超时,可能迁移已提交;重试一次同版本 publish 以确认模块状态。" >&2
attempt=$((attempt + 1))
sleep 5
done
}
if [[ -n "${RUN_AS_USER}" && "$(id -u)" -eq 0 ]]; then
if ! id "${RUN_AS_USER}" >/dev/null 2>&1; then
echo "[production-stdb-publish] 发布用户不存在: ${RUN_AS_USER}" >&2
@@ -931,10 +959,10 @@ if [[ -n "${RUN_AS_USER}" && "$(id -u)" -eq 0 ]]; then
PUBLISH_ARGS+=(--server "${SERVER_ALIAS}")
fi
PUBLISH_STARTED=1
runuser -u "${RUN_AS_USER}" -- spacetime "${PUBLISH_ARGS[@]}"
run_spacetime_publish
else
PUBLISH_STARTED=1
spacetime "${PUBLISH_ARGS[@]}"
run_spacetime_publish
fi
RUNTIME_SERVICE_BOOTSTRAP_SECRET_DIR="$(dirname "${RUNTIME_SERVICE_BOOTSTRAP_SECRET_FILE}")"