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 }