Skip to content

Commit

Permalink
hack: Disable is_syncing checks
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Sep 11, 2023
1 parent 25b6d9c commit e56f046
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/beacon/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (d *Default) Start(ctx context.Context) error {
go func() {
for {
// Wait until we have a single healthy node.
_, err := d.nodes.Healthy(ctx).NotSyncing(ctx).RandomNode(ctx)
_, err := d.nodes.Ready(ctx).RandomNode(ctx)
if err != nil {
d.log.WithError(err).Error("Waiting for a healthy, non-syncing node before beginning..")
time.Sleep(time.Second * 5)
Expand Down
12 changes: 4 additions & 8 deletions pkg/beacon/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,15 @@ func (n Nodes) Syncing(ctx context.Context) Nodes {

func (n Nodes) Ready(ctx context.Context) Nodes {
return n.
Healthy(ctx).
NotSyncing(ctx)
Healthy(ctx)
}

func (n Nodes) RandomNode(ctx context.Context) (*Node, error) {
nodes := n.Ready(ctx)

if len(nodes) == 0 {
return nil, errors.New("no nodes found")
if len(n) == 0 {
return nil, errors.New("no nodes available")
}

//nolint:gosec // not critical to worry about/will probably be replaced.
return nodes[rand.Intn(len(nodes))], nil
return n[rand.Intn(len(n))], nil
}

func (n Nodes) Filter(ctx context.Context, f func(*Node) bool) Nodes {
Expand Down

0 comments on commit e56f046

Please sign in to comment.