feat: add passive channel monitoring mode (#5592)

* feat: add passive channel monitoring mode

* fix: clarify passive monitor mode copy
This commit is contained in:
Herb Brewer
2026-06-22 18:07:44 +08:00
committed by GitHub
parent e5694748c7
commit efd6c445ac
14 changed files with 200 additions and 15 deletions
@@ -10,12 +10,19 @@ import (
type MonitorSetting struct {
AutoTestChannelEnabled bool `json:"auto_test_channel_enabled"`
AutoTestChannelMinutes float64 `json:"auto_test_channel_minutes"`
ChannelTestMode string `json:"channel_test_mode"`
}
const (
ChannelTestModeScheduledAll = "scheduled_all"
ChannelTestModePassiveRecovery = "passive_recovery"
)
// 默认配置
var monitorSetting = MonitorSetting{
AutoTestChannelEnabled: false,
AutoTestChannelMinutes: 10,
ChannelTestMode: ChannelTestModeScheduledAll,
}
func init() {
@@ -29,6 +36,7 @@ func GetMonitorSetting() *MonitorSetting {
if err == nil && frequency > 0 {
monitorSetting.AutoTestChannelEnabled = true
monitorSetting.AutoTestChannelMinutes = float64(frequency)
monitorSetting.ChannelTestMode = ChannelTestModeScheduledAll
}
}
if enabled, ok := os.LookupEnv("CHANNEL_TEST_ENABLED"); ok {
@@ -37,5 +45,8 @@ func GetMonitorSetting() *MonitorSetting {
monitorSetting.AutoTestChannelEnabled = parsed
}
}
if monitorSetting.ChannelTestMode != ChannelTestModePassiveRecovery {
monitorSetting.ChannelTestMode = ChannelTestModeScheduledAll
}
return &monitorSetting
}