mirror of
https://github.com/DullJZ/s3-balance.git
synced 2026-07-13 00:11:26 +08:00
22 lines
578 B
Go
22 lines
578 B
Go
package api
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/DullJZ/s3-balance/internal/bucket"
|
|
)
|
|
|
|
// recordBackendOperation increments backend operation counters and disables the bucket if limits are exceeded.
|
|
func (h *S3Handler) recordBackendOperation(b *bucket.BucketInfo, category bucket.OperationCategory) {
|
|
if b == nil {
|
|
return
|
|
}
|
|
|
|
if h.metrics != nil {
|
|
h.metrics.RecordBackendOperation(b.Config.Name, string(category))
|
|
}
|
|
if disabled := b.RecordOperation(category); disabled {
|
|
log.Printf("Bucket %s disabled after exceeding %s-type operation limit", b.Config.Name, category)
|
|
}
|
|
}
|