diff --git a/cmd/main.go b/cmd/main.go index a1c92b6..bcc40ca 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -136,6 +136,10 @@ func main() { validatorExitRequestScannerService := services.NewValidatorExitRequestEventScanner(storageAdapter, notifierAdapter, veboAdapter, executionAdapter, beaconchainAdapter, networkConfig.VeboBlockDeployment) validatorEjectorService := services.NewValidatorEjectorService(storageAdapter, notifierAdapter, exitValidatorAdapter, beaconchainAdapter) pendingHashesLoaderService := services.NewPendingHashesLoader(storageAdapter, ipfsAdapter) + relaysCheckerService := services.NewRelayCronService(relaysAllowedAdapter, relaysUsedAdapter, notifierAdapter) + + // Relays + relaysCheckerService.StartRelayMonitoringCron(ctx, 5*time.Minute, &wg) // DistributionLogUpdated distributionLogUpdatedExecutionComplete := make(chan struct{}) diff --git a/internal/application/services/relaysChecker.go b/internal/application/services/relaysChecker.go index 38e981e..f6cdc5e 100644 --- a/internal/application/services/relaysChecker.go +++ b/internal/application/services/relaysChecker.go @@ -22,7 +22,6 @@ func NewRelayCronService( relaysAllowedPort ports.RelaysAllowedPort, relaysUsedPort ports.RelaysUsedPort, notifierPort ports.NotifierPort, - servicePrefix string, ) *RelayCronService { return &RelayCronService{ relaysAllowedPort: relaysAllowedPort, @@ -32,13 +31,10 @@ func NewRelayCronService( } } -func (rcs *RelayCronService) StartRelayMonitoringCron(ctx context.Context, interval time.Duration, wg *sync.WaitGroup, firstExecutionComplete chan struct{}) { +func (rcs *RelayCronService) StartRelayMonitoringCron(ctx context.Context, interval time.Duration, wg *sync.WaitGroup) { defer wg.Done() wg.Add(1) - <-firstExecutionComplete - logger.DebugWithPrefix(rcs.servicePrefix, "Signal received, starting periodic cron for monitoring relays") - // Execute immediately on startup if err := rcs.monitorRelays(ctx); err != nil { logger.ErrorWithPrefix(rcs.servicePrefix, "Error monitoring relays: %v", err)