4 Commits

Author SHA1 Message Date
895146b472 Версия v1.1.2
All checks were successful
Release / release (push) Successful in 4m2s
2025-11-22 21:28:39 +08:00
522012d7d5 Фикс подсчёта онлайн-оффлайн каналов 2025-11-22 21:28:06 +08:00
a3c33d7ec1 Версия v1.1.1
All checks were successful
Release / release (push) Successful in 4m53s
2025-11-22 19:28:00 +08:00
d7f28413b2 Скорректировано поведение --repeat
При значении 0 количество итераций будет бесконечным
2025-11-22 19:27:33 +08:00
3 changed files with 10 additions and 11 deletions

View File

@@ -14,7 +14,7 @@ import (
"github.com/redis/go-redis/v9" "github.com/redis/go-redis/v9"
) )
const VERSION = "1.1.0" const VERSION = "1.1.2"
// Arguments описывает аргументы командной строки // Arguments описывает аргументы командной строки
type Arguments struct { type Arguments struct {

View File

@@ -196,6 +196,9 @@ func CheckChannels(pls playlist.Playlist) playlist.Playlist {
return pls return pls
} }
pls.OnlineCount = 0
pls.OfflineCount = 0
timeout, routines := calcParameters(count) timeout, routines := calcParameters(count)
httpClient := http.Client{Timeout: timeout} httpClient := http.Client{Timeout: timeout}
chSemaphores := make(chan struct{}, routines) chSemaphores := make(chan struct{}, routines)

View File

@@ -35,13 +35,8 @@ var checkCmd = &cobra.Command{
} }
currentIteration := 1 currentIteration := 1
iterationCount := app.Args.RepeatCount
if iterationCount <= 0 {
iterationCount = 1
}
for { for {
if app.Args.RepeatCount > 1 { if app.Args.RepeatCount != 1 {
log.Printf( log.Printf(
"@ New iteration current=%d count=%d\n", "@ New iteration current=%d count=%d\n",
currentIteration, currentIteration,
@@ -65,11 +60,12 @@ var checkCmd = &cobra.Command{
fmt.Println(string(marshal)) fmt.Println(string(marshal))
} }
if app.Args.RepeatCount <= 1 || uint(currentIteration) == app.Args.RepeatCount { if app.Args.RepeatCount != 0 {
break if uint(currentIteration) == app.Args.RepeatCount {
break
}
currentIteration++
} }
currentIteration++
log.Printf("Waiting for new iteration... seconds=%d\n", app.Args.RepeatEverySec) log.Printf("Waiting for new iteration... seconds=%d\n", app.Args.RepeatEverySec)
time.Sleep(time.Duration(app.Args.RepeatEverySec) * time.Second) time.Sleep(time.Duration(app.Args.RepeatEverySec) * time.Second)
} }