Skip to content

Commit

Permalink
Merge pull request #6138 from spacemeshos/backport/1.6/6137
Browse files Browse the repository at this point in the history
Fix ATX syncer hangs (#6137)
  • Loading branch information
poszu authored Jul 16, 2024
2 parents 2f80519 + e64a1dc commit 69618c8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

See [RELEASE](./RELEASE.md) for workflow instructions.

## Release v1.6.3

### Improvements

* [#6137](https://github.com/spacemeshos/go-spacemesh/pull/6137) Fix hanging ATX sync.

## Release v1.6.2

### Improvements
Expand Down
8 changes: 4 additions & 4 deletions syncer/atxsync/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func DefaultConfig() Config {
return Config{
EpochInfoInterval: 4 * time.Hour,
AtxsBatch: 1000,
RequestsLimit: 20,
RequestsLimit: 10,
EpochInfoPeers: 2,
ProgressFraction: 0.1,
ProgressInterval: 20 * time.Minute,
Expand Down Expand Up @@ -314,10 +314,10 @@ func (s *Syncer) downloadAtxs(
if _, exists := state[types.ATXID(hash)]; !exists {
continue
}
if errors.Is(err, fetch.ErrExceedMaxRetries) {
state[types.ATXID(hash)]++
} else if errors.Is(err, pubsub.ErrValidationReject) {
if errors.Is(err, pubsub.ErrValidationReject) {
state[types.ATXID(hash)] = s.cfg.RequestsLimit
} else {
state[types.ATXID(hash)]++
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion syncer/atxsync/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func TestSyncer(t *testing.T) {
}
for _, bad := range bad.AtxIDs {
if bad == id {
berr.Add(bad.Hash32(), fmt.Errorf("%w: test", fetch.ErrExceedMaxRetries))
berr.Add(bad.Hash32(), fmt.Errorf("%w: test", errors.New("oh no failed")))
}
}
}
Expand Down

0 comments on commit 69618c8

Please sign in to comment.