From 338e914a606fbd3958dd15e01a5c294640848b7a Mon Sep 17 00:00:00 2001 From: CaIon Date: Thu, 10 Jul 2025 11:31:07 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20refactor(channel):=20add=20valid?= =?UTF-8?q?ation=20for=20CHANNEL=5FTEST=5FFREQUENCY=20in=20automatic=20tes?= =?UTF-8?q?ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/channel-test.go | 4 ++++ main.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/controller/channel-test.go b/controller/channel-test.go index 009219a7..efc8cd96 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -354,6 +354,10 @@ func TestAllChannels(c *gin.Context) { } func AutomaticallyTestChannels(frequency int) { + if frequency <= 0 { + common.SysLog("CHANNEL_TEST_FREQUENCY is not set or invalid, skipping automatic channel test") + return + } for { time.Sleep(time.Duration(frequency) * time.Minute) common.SysLog("testing all channels") diff --git a/main.go b/main.go index ca3da601..996b65b3 100644 --- a/main.go +++ b/main.go @@ -168,11 +168,11 @@ func InitResources() error { common.SysLog("No .env file found, using default environment variables. If needed, please create a .env file and set the relevant variables.") } + common.SetupLogger() + // 加载环境变量 common.InitEnv() - common.SetupLogger() - // Initialize model settings ratio_setting.InitRatioSettings()