Skip to content

Commit

Permalink
Merge branch 'main' into discovery_metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
walldiss committed May 10, 2023
2 parents f722beb + e632a47 commit bff848e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions das/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ func (s *coordinatorState) handleResult(res result) {
// if job was already in retry and failed again, carry over attempt count
lastRetry, ok := s.inRetry[h]
if ok {
if res.job.jobType != retryJob {
// retry job has been already created by another worker (recent or catchup)
continue
}
delete(s.inRetry, h)
}

Expand Down
4 changes: 2 additions & 2 deletions share/availability/discovery/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
func TestDiscovery(t *testing.T) {
const nodes = 10 // higher number brings higher coverage

discoveryRetryTimeout = time.Millisecond * 100 // defined in discovery.go

ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
t.Cleanup(cancel)

Expand All @@ -28,7 +30,6 @@ func TestDiscovery(t *testing.T) {
WithPeersLimit(nodes),
WithAdvertiseInterval(-1),
)
discoveryRetryTimeout = time.Millisecond * 100 // defined in discovery.go

type peerUpdate struct {
peerID peer.ID
Expand All @@ -42,7 +43,6 @@ func TestDiscovery(t *testing.T) {
discs := make([]*Discovery, nodes)
for i := range discs {
discs[i] = tn.discovery(WithPeersLimit(0), WithAdvertiseInterval(time.Millisecond*100))
discoveryRetryTimeout = -1 // defined in discovery.go

select {
case res := <-updateCh:
Expand Down
2 changes: 1 addition & 1 deletion share/p2p/shrexeds/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (c *Client) RequestEDS(
log.Debugw("client: eds request to peer failed", "peer", peer, "hash", dataHash.String(), "error", err)
if errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled) {
c.metrics.ObserveRequests(1, p2p.StatusTimeout)
return nil, ctx.Err()
return nil, err
}
// some net.Errors also mean the context deadline was exceeded, but yamux/mocknet do not
// unwrap to a ctx err
Expand Down

0 comments on commit bff848e

Please sign in to comment.