Skip to content

Commit

Permalink
feat(consensus): Sleep the subscription loop until genesis
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Jul 21, 2022
1 parent 769a3c6 commit 5092c2e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/exporter/consensus/beacon/subscriptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ func (n *node) ensureBeaconSubscription(ctx context.Context) error {
continue
}

if !time.Now().After(n.genesis.GenesisTime) {
continue
timeTillGenesis := time.Until(n.genesis.GenesisTime)
if timeTillGenesis > 0 {
n.log.WithField("time_until_genesis", timeTillGenesis.String()).Info("We are pre-genesis, not subscribing upstream yet...")

time.Sleep(timeTillGenesis)
}

n.log.
Expand All @@ -44,7 +47,7 @@ func (n *node) ensureBeaconSubscription(ctx context.Context) error {
n.log.WithError(err).Error("Failed to subscribe to beacon")
}

time.Sleep(time.Second * 60)
time.Sleep(time.Minute * 15)
}
}
}
Expand Down

0 comments on commit 5092c2e

Please sign in to comment.