Skip to content

Commit

Permalink
fix(objectnode): fix s3qos zero nodenum
Browse files Browse the repository at this point in the history
Signed-off-by: tangdeyi <[email protected]>
  • Loading branch information
tangdeyi committed Aug 31, 2023
1 parent 95c3c12 commit 210de3e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions objectnode/ratelimit.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ func (o *ObjectNode) Reload(data []byte) error {
}
apiLimitConf := s3QosResponse.ApiLimitConf
s3NodeNum := s3QosResponse.Nodes
if s3NodeNum == 0 {
o.limitMutex.Lock()
o.rateLimit = &NullRateLimit{}
o.limitMutex.Unlock()
return nil
}
for _, userLimitConf := range apiLimitConf {
for uid, bandWidthQuota := range userLimitConf.BandWidthQuota {
quota := bandWidthQuota / s3NodeNum
Expand Down
3 changes: 3 additions & 0 deletions objectnode/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ func handleStart(s common.Server, cfg *config.Config) (err error) {
err = reloadconf.StartReload(reloadConf, o.Reload)
if err != nil {
log.LogWarnf("handleStart: GetS3QoSInfo err(%v)", err)
o.limitMutex.Lock()
o.rateLimit = &NullRateLimit{}
o.limitMutex.Unlock()
}

// start rest api
Expand Down

0 comments on commit 210de3e

Please sign in to comment.