Skip to content

Commit ccd8ff0

Browse files
committed
metrics: add more block related stats;
1 parent 1fe5de0 commit ccd8ff0

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

miner/worker.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,11 @@ func (env *environment) discard() {
150150

151151
// task contains all information for consensus engine sealing and result submitting.
152152
type task struct {
153-
receipts []*types.Receipt
154-
state *state.StateDB
155-
block *types.Block
156-
createdAt time.Time
153+
receipts []*types.Receipt
154+
state *state.StateDB
155+
block *types.Block
156+
createdAt time.Time
157+
157158
miningStartAt time.Time
158159
}
159160

p2p/peer.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ const (
4747
snappyProtocolVersion = 5
4848

4949
pingInterval = 15 * time.Second
50+
51+
slowPeerLatencyThreshold = 500
5052
)
5153

5254
const (
@@ -358,7 +360,7 @@ func (p *Peer) pingLoop() {
358360
if latency > 0 {
359361
p.latency.Store(latency)
360362
peerLatencyStat.Update(time.Duration(latency))
361-
if latency > 1000 {
363+
if latency > slowPeerLatencyThreshold {
362364
log.Warn("find a too slow peer", "id", p.ID(), "peer", p.RemoteAddr(), "latency", latency)
363365
}
364366
}

0 commit comments

Comments
 (0)