From 98957b6e8e879da532a9d609b97ad92d232a4134 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 26 Oct 2021 14:42:42 +1100 Subject: [PATCH] Only assert pending requests when check is enabled Uses too much CPU for production from its current callsites. --- torrent.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/torrent.go b/torrent.go index d606971d..5f18df1f 100644 --- a/torrent.go +++ b/torrent.go @@ -1408,6 +1408,9 @@ func (t *Torrent) numActivePeers() (num int) { } func (t *Torrent) assertPendingRequests() { + if !check { + return + } var actual pendingRequests if t.haveInfo() { actual.m = make([]int, t.numRequests()) -- 2.48.1