Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix ci
  • Loading branch information
eye-gu committed Jun 10, 2026
commit e53bddf80bba1d8bb2b6199caf0bd8f472a2a470
10 changes: 7 additions & 3 deletions registry/servicediscovery/service_discovery_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package servicediscovery

import (
"errors"
"math/rand"
"math/rand/v2"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -384,7 +384,7 @@ func (s *serviceDiscoveryRegistry) calculateRenewAppMetadataDelay() time.Duratio
// Next day 2:00 AM
nextDay2AM := time.Date(now.Year(), now.Month(), now.Day()+1, 2, 0, 0, 0, now.Location())
// Add random offset 0~4 hours to avoid thundering herd
randomOffset := time.Duration(rand.Int63n(int64(4 * time.Hour)))
randomOffset := time.Duration(rand.Int64N(int64(4 * time.Hour)))
return time.Until(nextDay2AM) + randomOffset
}

Expand Down Expand Up @@ -412,7 +412,11 @@ func (s *serviceDiscoveryRegistry) doGarbageCollect() {
}

// Step 2: Filter stale candidates (exceed GC window in days)
gcWindowDays := int(s.url.GetParamInt(constant.MetadataGCWindowKey, 5))
gcWindowRaw := s.url.GetParamInt(constant.MetadataGCWindowKey, 5)
if gcWindowRaw <= 0 || gcWindowRaw > 365 {
gcWindowRaw = 5
}
gcWindowDays := int(gcWindowRaw)
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
cutoff := time.Now().AddDate(0, 0, -gcWindowDays).UnixMilli()
candidates := make(map[string]bool)
for _, rev := range revisions {
Expand Down