实现在心跳中采集各设备信息

This commit is contained in:
2025-09-09 11:51:13 +08:00
parent fc657d7448
commit 00822427ca
10 changed files with 293 additions and 36 deletions

View File

@@ -83,6 +83,9 @@ type WebSocketConfig struct {
type HeartbeatConfig struct {
// Interval 心跳间隔(秒)
Interval int `yaml:"interval"`
// Concurrency 请求并发数
Concurrency int `yaml:"concurrency"`
}
// NewConfig 创建并返回一个新的配置实例
@@ -135,10 +138,7 @@ func (c *Config) GetWebSocketTimeout() int {
return c.WebSocket.Timeout
}
// GetHeartbeatInterval 获取心跳间隔(秒)
func (c *Config) GetHeartbeatInterval() int {
if c.Heartbeat.Interval <= 0 {
return 30 // 默认30秒心跳间隔
}
return c.Heartbeat.Interval
// GetHeartbeatConfig 获取心跳配置
func (c *Config) GetHeartbeatConfig() HeartbeatConfig {
return c.Heartbeat
}