diff --git a/handlers/validators.go b/handlers/validators.go index 0cdfe3a93b..cd61d43900 100644 --- a/handlers/validators.go +++ b/handlers/validators.go @@ -28,7 +28,7 @@ func Validators(w http.ResponseWriter, r *http.Request) { currentStateCounts := services.LatestValidatorStateCounts() - for _, state := range currentStateCounts { + for _, state := range *currentStateCounts { switch state.Name { case "pending": validatorsPageData.PendingCount = state.Count diff --git a/services/monitoring.go b/services/monitoring.go index 8ed3cabcb9..fb84444dd6 100644 --- a/services/monitoring.go +++ b/services/monitoring.go @@ -268,7 +268,7 @@ func startServicesMonitoringService() { "statistics": time.Minute * 90, "ethStoreStatistics": time.Minute * 15, "lastExportedStatisticDay": time.Minute * 15, - "validatorStateCountsUpdater": time.Minute * 15, + "validatorStateCountsUpdater": time.Minute * 90, //"notification-sender", //exclude for now as the sender is only running on mainnet } diff --git a/services/services.go b/services/services.go index 85807892e1..b78f21451e 100644 --- a/services/services.go +++ b/services/services.go @@ -1797,17 +1797,17 @@ func validatorStateCountsUpdater(wg *sync.WaitGroup) { } } ReportStatus("validatorStateCountsUpdater", "Running", nil) - time.Sleep(time.Minute) + time.Sleep(time.Minute * 60) } } -func LatestValidatorStateCounts() []types.ValidatorStateCountRow { +func LatestValidatorStateCounts() *[]types.ValidatorStateCountRow { wanted := []types.ValidatorStateCountRow{} cacheKey := fmt.Sprintf("%d:frontend:validator_state_counts", utils.Config.Chain.ClConfig.DepositChainID) - if wanted, err := cache.TieredCache.GetWithLocalTimeout(cacheKey, time.Minute, wanted); err == nil { - return wanted.([]types.ValidatorStateCountRow) + if wanted, err := cache.TieredCache.GetWithLocalTimeout(cacheKey, time.Minute, &wanted); err == nil { + return wanted.(*[]types.ValidatorStateCountRow) } else { logger.Errorf("error retrieving validator state count data from cache: %v", err) } - return wanted + return &wanted }