diff options
author | Péter Szilágyi <peterke@gmail.com> | 2015-08-25 18:57:49 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2015-08-25 22:48:47 +0800 |
commit | 17f65cd1e5e0fea6e4f7b96c60767aaa0ada366d (patch) | |
tree | 946f0e2478d8002194c09705e638c74b9d3a8ec5 /eth/downloader/queue.go | |
parent | 47a7fe5d22fe2a6be783f6576070814fe951eaaf (diff) | |
download | go-tangerine-17f65cd1e5e0fea6e4f7b96c60767aaa0ada366d.tar go-tangerine-17f65cd1e5e0fea6e4f7b96c60767aaa0ada366d.tar.gz go-tangerine-17f65cd1e5e0fea6e4f7b96c60767aaa0ada366d.tar.bz2 go-tangerine-17f65cd1e5e0fea6e4f7b96c60767aaa0ada366d.tar.lz go-tangerine-17f65cd1e5e0fea6e4f7b96c60767aaa0ada366d.tar.xz go-tangerine-17f65cd1e5e0fea6e4f7b96c60767aaa0ada366d.tar.zst go-tangerine-17f65cd1e5e0fea6e4f7b96c60767aaa0ada366d.zip |
eth: update metrics collection to handle eth/62 algos
Diffstat (limited to 'eth/downloader/queue.go')
-rw-r--r-- | eth/downloader/queue.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/eth/downloader/queue.go b/eth/downloader/queue.go index a527414ff..7db78327b 100644 --- a/eth/downloader/queue.go +++ b/eth/downloader/queue.go @@ -397,9 +397,19 @@ func (q *queue) Expire(timeout time.Duration) []string { peers := []string{} for id, request := range q.pendPool { if time.Since(request.Time) > timeout { + // Update the metrics with the timeout + if len(request.Hashes) > 0 { + blockTimeoutMeter.Mark(1) + } else { + bodyTimeoutMeter.Mark(1) + } + // Return any non satisfied requests to the pool for hash, index := range request.Hashes { q.hashQueue.Push(hash, float32(index)) } + for _, header := range request.Headers { + q.headerQueue.Push(header, -float32(header.Number.Uint64())) + } peers = append(peers, id) } } @@ -420,6 +430,7 @@ func (q *queue) Deliver61(id string, blocks []*types.Block) (err error) { if request == nil { return errNoFetchesPending } + blockReqTimer.UpdateSince(request.Time) delete(q.pendPool, id) // If no blocks were retrieved, mark them as unavailable for the origin peer @@ -468,6 +479,7 @@ func (q *queue) Deliver(id string, txLists [][]*types.Transaction, uncleLists [] if request == nil { return errNoFetchesPending } + bodyReqTimer.UpdateSince(request.Time) delete(q.pendPool, id) // If no block bodies were retrieved, mark them as unavailable for the origin peer |