Browse Source

Filer: Replace magic numbers with named constants in retry processor

Replace hardcoded values with package-level constants for better
maintainability:
- DeletionRetryPollInterval (1 minute): interval for checking retry queue
- DeletionRetryBatchSize (1000): max items to process per iteration

This improves code readability and makes configuration changes easier.
pull/7402/head
Dimonyga 1 month ago
parent
commit
f36e0607e8
  1. 8
      weed/filer/filer_deletion.go

8
weed/filer/filer_deletion.go

@ -23,6 +23,10 @@ const (
InitialRetryDelay = 5 * time.Minute
// Maximum retry delay
MaxRetryDelay = 6 * time.Hour
// Interval for checking retry queue for ready items
DeletionRetryPollInterval = 1 * time.Minute
// Maximum number of items to process per retry iteration
DeletionRetryBatchSize = 1000
)
// DeletionRetryItem represents a file deletion that failed and needs to be retried
@ -233,7 +237,7 @@ func isRetryableError(errorMsg string) bool {
// loopProcessingDeletionRetry processes the retry queue for failed deletions
func (f *Filer) loopProcessingDeletionRetry(lookupFunc func([]string) (map[string]*operation.LookupResult, error), retryQueue *DeletionRetryQueue) {
ticker := time.NewTicker(1 * time.Minute)
ticker := time.NewTicker(DeletionRetryPollInterval)
defer ticker.Stop()
for {
@ -243,7 +247,7 @@ func (f *Filer) loopProcessingDeletionRetry(lookupFunc func([]string) (map[strin
return
case <-ticker.C:
// Get items that are ready to retry
readyItems := retryQueue.GetReadyItems(1000)
readyItems := retryQueue.GetReadyItems(DeletionRetryBatchSize)
if len(readyItems) == 0 {
continue

Loading…
Cancel
Save