-
Notifications
You must be signed in to change notification settings - Fork 110
api, metrics, network: check caps when deciding on next peer for a chunk #1749
Changes from 3 commits
7ef600f
b278c14
c1de0f4
dcdbc3d
8b5ff92
ecf0094
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,7 +121,7 @@ func datadirDiskUsage(path string, d time.Duration) { | |
for range time.Tick(d) { | ||
bytes, err := dirSize(path) | ||
if err != nil { | ||
log.Warn("cannot get disk space", "err", err) | ||
log.Trace("cannot get disk space", "err", err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This warning is annoying when we hit LevelDB during compaction, and it is mostly useless in our monitoring system, therefore I am reducing its level. |
||
} | ||
|
||
metrics.GetOrRegisterGauge("datadir.usage", nil).Update(bytes) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -231,6 +231,10 @@ func (r *Retrieval) findPeer(ctx context.Context, req *storage.Request) (retPeer | |
return true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, this can be removed. 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted it back, because we change the check for capabilities for |
||
} | ||
|
||
if !p.HasCap("bzz-stream") { | ||
return true | ||
} | ||
|
||
// do not send request back to peer who asked us. maybe merge with SkipPeer at some point | ||
if bytes.Equal(req.Origin.Bytes(), id.Bytes()) { | ||
return true | ||
|
@@ -410,11 +414,11 @@ FINDPEER: | |
|
||
protoPeer := r.getPeer(sp.ID()) | ||
if protoPeer == nil { | ||
r.logger.Warn("findPeer returned a peer to skip", "peer", sp.String(), "retry", retries) | ||
r.logger.Warn("findPeer returned a peer to skip", "peer", sp.String(), "retry", retries, "ref", req.Addr) | ||
req.PeersToSkip.Store(sp.ID().String(), time.Now()) | ||
retries++ | ||
if retries == maxFindPeerRetries { | ||
r.logger.Error("max find peer retries reached", "max retries", maxFindPeerRetries) | ||
r.logger.Error("max find peer retries reached", "max retries", maxFindPeerRetries, "ref", req.Addr) | ||
return nil, ErrNoPeerFound | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Independent of the
findPeer - RequestFromPeers
bug, but nonetheless a nice-to-have fix, so thatDeliveriesFromPeers
debug API works.