mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Run modernize (#21546)
`go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./...` executed. `go generate ./...` ran afterwards to keep generated.
This commit is contained in:
@@ -26,10 +26,12 @@ import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"math/rand"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -240,11 +242,9 @@ func (c *SiteReplicationSys) Init(ctx context.Context, objAPI ObjectLayer) error
|
||||
}
|
||||
replLogOnceIf(context.Background(), fmt.Errorf("unable to initialize site replication subsystem: (%w)", err), "site-relication-init")
|
||||
|
||||
duration := time.Duration(r.Float64() * float64(time.Minute))
|
||||
if duration < time.Second {
|
||||
duration := max(time.Duration(r.Float64()*float64(time.Minute)),
|
||||
// Make sure to sleep at least a second to avoid high CPU ticks.
|
||||
duration = time.Second
|
||||
}
|
||||
time.Second)
|
||||
time.Sleep(duration)
|
||||
}
|
||||
c.RLock()
|
||||
@@ -720,7 +720,6 @@ func (c *SiteReplicationSys) Netperf(ctx context.Context, duration time.Duration
|
||||
var wg sync.WaitGroup
|
||||
var resultsMu sync.RWMutex
|
||||
for _, info := range infos.Sites {
|
||||
info := info
|
||||
// will call siteNetperf, means call others's adminAPISiteReplicationDevNull
|
||||
if globalDeploymentID() == info.DeploymentID {
|
||||
wg.Add(1)
|
||||
@@ -2831,9 +2830,7 @@ func (c *SiteReplicationSys) siteReplicationStatus(ctx context.Context, objAPI O
|
||||
|
||||
info.Enabled = true
|
||||
info.Sites = make(map[string]madmin.PeerInfo, len(c.state.Peers))
|
||||
for d, peer := range c.state.Peers {
|
||||
info.Sites[d] = peer
|
||||
}
|
||||
maps.Copy(info.Sites, c.state.Peers)
|
||||
info.UpdatedAt = c.state.UpdatedAt
|
||||
|
||||
var maxBuckets int
|
||||
@@ -3816,9 +3813,7 @@ func (c *SiteReplicationSys) SiteReplicationMetaInfo(ctx context.Context, objAPI
|
||||
info.ILMExpiryRules[opts.EntityValue] = rule
|
||||
}
|
||||
} else {
|
||||
for id, rule := range allRules {
|
||||
info.ILMExpiryRules[id] = rule
|
||||
}
|
||||
maps.Copy(info.ILMExpiryRules, allRules)
|
||||
}
|
||||
}
|
||||
if opts.PeerState {
|
||||
@@ -3956,9 +3951,7 @@ func (c *SiteReplicationSys) SiteReplicationMetaInfo(ctx context.Context, objAPI
|
||||
return info, errSRBackendIssue(errG)
|
||||
}
|
||||
}
|
||||
for group, d := range groupDescMap {
|
||||
info.GroupDescMap[group] = d
|
||||
}
|
||||
maps.Copy(info.GroupDescMap, groupDescMap)
|
||||
}
|
||||
}
|
||||
// cache SR metadata info for IAM
|
||||
@@ -5692,11 +5685,8 @@ func isGroupDescEqual(g1, g2 madmin.GroupDesc) bool {
|
||||
}
|
||||
for _, v1 := range g1.Members {
|
||||
var found bool
|
||||
for _, v2 := range g2.Members {
|
||||
if v1 == v2 {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
if slices.Contains(g2.Members, v1) {
|
||||
found = true
|
||||
}
|
||||
if !found {
|
||||
return false
|
||||
@@ -5716,11 +5706,8 @@ func isUserInfoEqual(u1, u2 madmin.UserInfo) bool {
|
||||
}
|
||||
for _, v1 := range u1.MemberOf {
|
||||
var found bool
|
||||
for _, v2 := range u2.MemberOf {
|
||||
if v1 == v2 {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
if slices.Contains(u2.MemberOf, v1) {
|
||||
found = true
|
||||
}
|
||||
if !found {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user