Skip to content

Commit

Permalink
feat: halt
Browse files Browse the repository at this point in the history
  • Loading branch information
ToniRamirezM committed Aug 30, 2024
1 parent 6323ac4 commit d854dbb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func (a *Aggregator) handleReorg(reorgData synchronizer.ReorgExecutionResult) {
// Halt the aggregator
a.halted.Store(true)
for {
log.Warnf("Halting the aggregator due to a L1 reorg. Reorged data has been deleted so it is safe to manually restart the aggregator.")
log.Errorf("Halting the aggregator due to a L1 reorg. Reorged data has been deleted so it is safe to manually restart the aggregator.")
time.Sleep(10 * time.Second) // nolint:gomnd
}
}
Expand Down Expand Up @@ -380,9 +380,11 @@ func (a *Aggregator) handleRollbackBatches(rollbackData synchronizer.RollbackBat
if err == nil {
log.Info("Handling rollback batches event finished successfully")
} else {
// Halt the aggregator
a.halted.Store(true)
for {
log.Errorf("Error handling rollback batches event: %v", err)
time.Sleep(a.cfg.RetryTime.Duration)
log.Errorf("Halting the aggregator due to an error handling rollback batches event: %v", err)
time.Sleep(10 * time.Second) // nolint:gomnd
}
}
}
Expand Down Expand Up @@ -687,6 +689,9 @@ func (a *Aggregator) Start() error {
}

// Start stream client
a.streamClientMutex.Lock()
defer a.streamClientMutex.Unlock()

err = a.streamClient.Start()
if err != nil {
log.Fatalf("failed to start stream client, error: %v", err)
Expand Down

0 comments on commit d854dbb

Please sign in to comment.