Skip to content

Commit

Permalink
remove first execution complete
Browse files Browse the repository at this point in the history
  • Loading branch information
pablomendezroyo committed Dec 3, 2024
1 parent be65624 commit fefee2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 4 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
Expand Down
6 changes: 1 addition & 5 deletions internal/application/services/relaysChecker.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func NewRelayCronService(
relaysAllowedPort ports.RelaysAllowedPort,
relaysUsedPort ports.RelaysUsedPort,
notifierPort ports.NotifierPort,
servicePrefix string,
) *RelayCronService {
return &RelayCronService{
relaysAllowedPort: relaysAllowedPort,
Expand All @@ -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)
Expand Down

0 comments on commit fefee2f

Please sign in to comment.