修复事务重复收尾状态

防止正常提交后的保护性收尾再次覆盖已提交状态,确保事务最终记录稳定。
This commit is contained in:
xuans 2026-10-01 04:03:06 +08:00
parent a14d040e3f
commit 9b386bbde2

View File

@ -404,6 +404,7 @@ func (s *Service) deployOne(ctx context.Context, server Server, artifact Artifac
result.FailureCode = ""
result.Message = "证书已推送并重载,等待站点校验"
closed := false
finished := false
transaction := &pendingDeployment{index: index}
transaction.restore = func(recoveryContext context.Context) Result {
result.Status = "failed"
@ -445,6 +446,10 @@ func (s *Service) deployOne(ctx context.Context, server Server, artifact Artifac
return result
}
transaction.finish = func(retain bool) Result {
if finished {
return result
}
finished = true
if !closed {
retainLocks = retain
releaseLocks()