fix(release): 收紧分发热路径与事务边界
bat-rust / Build and test Rust (push) Canceled after 0s
bat-rust / Build and test Go API (push) Canceled after 0s

This commit is contained in:
2026-09-12 22:22:11 +08:00
parent f2c20367a6
commit 786b739f99
17 changed files with 835 additions and 124 deletions
+10 -1
View File
@@ -194,9 +194,18 @@ func (s *Server) loadReleaseDistributionFrom(r *http.Request, params backendrpc.
}
pageSize := 1000
result, err := backend.ReleaseDistribution(r.Context(), params)
if err != nil || result == nil || !result.Available || result.Total <= len(result.Entries) {
if err != nil || result == nil || !result.Available {
return result, err
}
if params.Destination != "" {
if result.Total != 1 || result.Offset != 0 || result.Limit != 1 || len(result.Entries) != 1 {
return nil, &releaseSelectorError{message: "Rust single-entry release distribution response is invalid"}
}
return result, nil
}
if result.Total <= len(result.Entries) {
return result, nil
}
all := append([]backendrpc.ReleaseDistributionEntry(nil), result.Entries...)
for offset := len(all); offset < result.Total; {
next, nextErr := backend.ReleaseDistribution(r.Context(), backendrpc.ReleaseDistributionParams{