mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-09-18 10:04:55 +08:00
fix(release): 收紧分发热路径与事务边界
This commit is contained in:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user