refactor bandwidth throttling for replication target (#17980)

This refactor is to allow using the bandwidth throttling
for other purposes.
This commit is contained in:
Harshavardhana
2023-09-05 20:21:59 -07:00
committed by GitHub
parent 812f5a02d7
commit 5b114b43f7
8 changed files with 153 additions and 179 deletions

View File

@@ -107,8 +107,8 @@ func (sys *BucketQuotaSys) enforceQuotaHard(ctx context.Context, bucket string,
return err
}
if q != nil && q.Type == madmin.HardQuota && q.Quota > 0 {
if uint64(size) >= q.Quota { // check if file size already exceeds the quota
if q != nil && q.Type == madmin.HardQuota && q.Size > 0 {
if uint64(size) >= q.Size { // check if file size already exceeds the quota
return BucketQuotaExceeded{Bucket: bucket}
}
@@ -117,7 +117,7 @@ func (sys *BucketQuotaSys) enforceQuotaHard(ctx context.Context, bucket string,
return err
}
if bui.Size > 0 && ((bui.Size + uint64(size)) >= q.Quota) {
if bui.Size > 0 && ((bui.Size + uint64(size)) >= q.Size) {
return BucketQuotaExceeded{Bucket: bucket}
}
}