Skip to content

Commit

Permalink
RM some retries
Browse files Browse the repository at this point in the history
  • Loading branch information
sergerad committed May 15, 2023
1 parent a758a1c commit b1ae839
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
20 changes: 8 additions & 12 deletions consensus/polybft/polybft.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
package polybft

import (
"context"
"encoding/json"
"fmt"
"path/filepath"
Expand Down Expand Up @@ -354,17 +353,14 @@ func (p *Polybft) Start() error {
}

// start syncing
go common.RetryForever(context.Background(), time.Second, func(context.Context) error {
blockHandler := func(b *types.FullBlock) bool {
p.runtime.OnBlockInserted(b)
return false
}
if err := p.syncer.Sync(blockHandler); err != nil {
p.logger.Error("blocks synchronization failed", "error", err)
return err
}
return nil
})
blockHandler := func(b *types.FullBlock) bool {
p.runtime.OnBlockInserted(b)
return false
}
if err := p.syncer.Sync(blockHandler); err != nil {
p.logger.Error("blocks synchronization failed", "error", err)
return err
}

// start consensus runtime
if err := p.startRuntime(); err != nil {
Expand Down
13 changes: 4 additions & 9 deletions jsonrpc/jsonrpc.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package jsonrpc

import (
"context"
"encoding/json"
"fmt"
"io"
Expand All @@ -10,7 +9,6 @@ import (
"sync"
"time"

"github.com/0xPolygon/polygon-edge/helper/common"
"github.com/0xPolygon/polygon-edge/versioning"
"github.com/gorilla/websocket"
"github.com/hashicorp/go-hclog"
Expand Down Expand Up @@ -128,13 +126,10 @@ func (j *JSONRPC) setupHTTP() error {
ReadHeaderTimeout: 60 * time.Second,
}

go common.RetryForever(context.Background(), time.Second, func(context.Context) error {
if err := srv.Serve(lis); err != nil {
j.logger.Error("closed http connection", "err", err)
return err
}
return nil
})
if err := srv.Serve(lis); err != nil {
j.logger.Error("closed http connection", "err", err)
return err
}

return nil
}
Expand Down
1 change: 1 addition & 0 deletions tracker/event_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func (e *EventTracker) Start(ctx context.Context) error {
return fmt.Errorf("failed to start blocktracker: %w", err)
}

// Run tracker
tt, err := tracker.NewTracker(provider.Eth(),
tracker.WithBatchSize(10),
tracker.WithBlockTracker(blockTracker),
Expand Down

0 comments on commit b1ae839

Please sign in to comment.