Skip to content

Commit

Permalink
Merge branch 'master' into pprof-metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
anodar committed Jul 14, 2023
2 parents 741a9c8 + 6d613c4 commit 77ad191
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions arbnode/dataposter/data_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ type queuedTransaction[Meta any] struct {
NextReplacement time.Time
}

// Note: one of the implementation of this interface (Redis storage) does not
// support duplicate values.
type QueueStorage[Item any] interface {
GetContents(ctx context.Context, startingIndex uint64, maxResults uint64) ([]*Item, error)
GetLast(ctx context.Context) (*Item, error)
Expand Down
5 changes: 4 additions & 1 deletion arbnode/dataposter/redis/redisstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import (
"github.com/offchainlabs/nitro/util/signature"
)

// Storage requires that Item is RLP encodable/decodable
// Storage implements redis sorted set backed storage. It does not support
// duplicate keys or values. That is, putting the same element on different
// indexes will not yield expected behavior.
// More at: https://redis.io/commands/zadd/.
type Storage[Item any] struct {
client redis.UniversalClient
signer *signature.SimpleHmac
Expand Down
9 changes: 7 additions & 2 deletions das/syncing_fallback_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,20 +370,25 @@ func (s *l1SyncService) readMore(ctx context.Context) error {
func (s *l1SyncService) mainThread(ctx context.Context) {
headerChan, unsubscribe := s.l1Reader.Subscribe(false)
defer unsubscribe()
errCount := 0
for {
err := s.readMore(ctx)
if err != nil {
if ctx.Err() != nil {
return
}
log.Error("error trying to sync from L1", "err", err)
errCount++
if errCount > 5 {
log.Error("error trying to sync from L1", "err", err)
}
select {
case <-ctx.Done():
return
case <-time.After(s.config.DelayOnError):
case <-time.After(s.config.DelayOnError * time.Duration(errCount)):
}
continue
}
errCount = 0
if s.catchingUp {
// we're behind. Don't wait.
continue
Expand Down

0 comments on commit 77ad191

Please sign in to comment.