From: Matt Joiner Date: Sat, 19 Jul 2025 11:45:58 +0000 (+1000) Subject: Coalesce synchronous webseed request updates X-Git-Tag: v1.59.0~5 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=164d222a7a944543a0f1daa18fb8bb9c8647a1fe;p=btrtrc.git Coalesce synchronous webseed request updates --- diff --git a/webseed-requesting.go b/webseed-requesting.go index 05f59636..71a1ec70 100644 --- a/webseed-requesting.go +++ b/webseed-requesting.go @@ -348,8 +348,10 @@ func (cl *Client) scheduleImmediateWebseedRequestUpdate() { // Timer function already running, let it do its thing. return } - // Handle the update right now. - cl.updateWebseedRequestsAndResetTimer() + // Set the timer to fire right away (this will coalesce consecutive updates without forcing an + // update on every call to this method). Since we're holding the Client lock, and we cancelled + // the timer and it wasn't active, nobody else should have reset it before us. + panicif.True(cl.webseedRequestTimer.Reset(0)) } func (cl *Client) updateWebseedRequestsTimerFunc() {