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 16:35:55 +08:00
parent 8d57a63697
commit 30d1cd77e8
20 changed files with 1100 additions and 102 deletions
+14 -9
View File
@@ -139,12 +139,13 @@ func (e *releaseSelectorError) Error() string {
return e.message
}
func (s *Server) loadReleaseDistribution(r *http.Request, channel, releaseID string) (*backendrpc.ReleaseDistributionPage, error) {
func (s *Server) loadReleaseDistribution(r *http.Request, channel, releaseID, destination string) (*backendrpc.ReleaseDistributionPage, error) {
return s.loadReleaseDistributionFrom(r, backendrpc.ReleaseDistributionParams{
Channel: channel,
ReleaseID: releaseID,
Offset: 0,
Limit: 1000,
Channel: channel,
ReleaseID: releaseID,
Destination: destination,
Offset: 0,
Limit: 1000,
})
}
@@ -154,6 +155,9 @@ func releaseDistributionParams(r *http.Request, channel, releaseID string) (back
ReleaseID: releaseID,
}
query := r.URL.Query()
if destination := strings.TrimSpace(query.Get("destination")); destination != "" {
params.Destination = destination
}
if raw := strings.TrimSpace(query.Get("offset")); raw != "" {
offset, err := strconv.ParseUint(raw, 10, 64)
if err != nil || uint64(int(^uint(0)>>1)) < offset {
@@ -196,10 +200,11 @@ func (s *Server) loadReleaseDistributionFrom(r *http.Request, params backendrpc.
all := append([]backendrpc.ReleaseDistributionEntry(nil), result.Entries...)
for offset := len(all); offset < result.Total; {
next, nextErr := backend.ReleaseDistribution(r.Context(), backendrpc.ReleaseDistributionParams{
Channel: params.Channel,
ReleaseID: params.ReleaseID,
Offset: offset,
Limit: pageSize,
Channel: params.Channel,
ReleaseID: params.ReleaseID,
Destination: params.Destination,
Offset: offset,
Limit: pageSize,
})
if nextErr != nil {
return nil, nextErr