mirror of
https://github.com/DullJZ/s3-balance.git
synced 2026-06-28 14:31:22 +08:00
persistant A&B record
This commit is contained in:
@@ -15,7 +15,22 @@ func (h *S3Handler) recordBackendOperation(b *bucket.BucketInfo, category bucket
|
||||
if h.metrics != nil {
|
||||
h.metrics.RecordBackendOperation(b.Config.Name, string(category))
|
||||
}
|
||||
if disabled := b.RecordOperation(category); disabled {
|
||||
|
||||
var disabled bool
|
||||
|
||||
if h.storage != nil {
|
||||
newCount, err := h.storage.IncrementBucketOperation(b.Config.Name, string(category))
|
||||
if err != nil {
|
||||
log.Printf("failed to persist backend operation count for bucket %s: %v", b.Config.Name, err)
|
||||
disabled = b.RecordOperation(category)
|
||||
} else {
|
||||
disabled = b.SetOperationCount(category, newCount)
|
||||
}
|
||||
} else {
|
||||
disabled = b.RecordOperation(category)
|
||||
}
|
||||
|
||||
if disabled {
|
||||
log.Printf("Bucket %s disabled after exceeding %s-type operation limit", b.Config.Name, category)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user