Defer dashboard RPCs until after ckpool notifier completes on tip change
On ZMQ hashblock events, wait for the ckpool "Block update latency" log line before firing dashboard RPC calls (getblockchaininfo, getnetworkhashps, etc). This avoids competing with ckpool's latency-critical getblocktemplate call for bitcoind RPC threads, which matters when many services flood bitcoind on every new block.
This commit is contained in:
@@ -103,6 +103,12 @@ func (a *Aggregator) IngestLatencyEvents(ctx context.Context, events <-chan logm
|
||||
a.staleWorkHashes += (float64(ev.LatencyMs) / 1000.0) * hs5m
|
||||
count, sum, last, stale := a.latencyCount, a.latencySumMs, a.latencyLastMs, a.staleWorkHashes
|
||||
a.mu.Unlock()
|
||||
// Signal the Run loop that ckpool's notifier is done so
|
||||
// dashboard RPC calls can proceed without competing.
|
||||
select {
|
||||
case a.notifierDone <- struct{}{}:
|
||||
default:
|
||||
}
|
||||
a.Log.Info("logmon: block update latency", "ms", ev.LatencyMs, "count", count)
|
||||
// Blocks are infrequent (~10min); persist every event.
|
||||
if a.Store != nil {
|
||||
|
||||
Reference in New Issue
Block a user