From edd18e92edc5d810703ed2833a9beb77e5afabc1 Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Thu, 2 Oct 2025 01:15:08 +0800 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D0=B0=20=D1=80=D0=B0=D1=81=D1=87?= =?UTF-8?q?=D1=91=D1=82=D0=B0=20=D1=80=D1=83=D1=82=D0=B8=D0=BD/=D1=82?= =?UTF-8?q?=D0=B0=D0=B9=D0=BC=D0=B0=D1=83=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/checker/checker.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/app/checker/checker.go b/app/checker/checker.go index 049f094..74eca6b 100644 --- a/app/checker/checker.go +++ b/app/checker/checker.go @@ -322,27 +322,22 @@ func CheckChannels(pls playlist.Playlist) playlist.Playlist { // calcParameters вычисляет оптимальное количество горутин и таймаут запроса func calcParameters(count int) (time.Duration, int) { - percentage := float32(runtime.NumCPU()) / 10 - for percentage >= 1 { - percentage *= 0.5 - } - - routines := int(float32(count) * percentage) - if routines > 1500 { - routines = 1500 + routines := count + if routines > 3000 { + routines = 3000 } if routines < 1 { routines = 1 } - var digits int + var digits = 1 x := count for x >= 10 { digits++ x /= 10 } - timeout := int(math.Ceil(math.Pow(10, float64(digits)) / float64(count) * 15)) + timeout := 10 - int(math.Ceil(float64(digits)*1.5)) if timeout > 10 { timeout = 10 }