Skip to content

Commit 44923aa

Browse files
authored
Merge pull request #42 from VictoriaMetrics-Community/heartbeat-disable
implemented an ability to disable the heartbeat interval (MCP_HEARTBEAT_INTERVAL=0)
2 parents 7654b37 + 7730f56 commit 44923aa

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

cmd/mcp-victorialogs/config/config.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ func InitConfig() (*Config, error) {
5050
}
5151
}
5252

53-
var heartbeatInterval time.Duration
53+
heartbeatInterval := 30 * time.Second
5454
heartbeatIntervalStr := os.Getenv("MCP_HEARTBEAT_INTERVAL")
5555
if heartbeatIntervalStr != "" {
5656
interval, err := time.ParseDuration(heartbeatIntervalStr)
5757
if err != nil {
5858
return nil, fmt.Errorf("failed to parse MCP_HEARTBEAT_INTERVAL: %w", err)
5959
}
60-
if interval <= 0 {
61-
return nil, fmt.Errorf("MCP_HEARTBEAT_INTERVAL must be greater than 0")
60+
if interval < 0 {
61+
return nil, fmt.Errorf("MCP_HEARTBEAT_INTERVAL must be a non-negative")
6262
}
6363
heartbeatInterval = interval
6464
}
@@ -132,9 +132,6 @@ func (c *Config) IsToolDisabled(toolName string) bool {
132132
}
133133

134134
func (c *Config) HeartbeatInterval() time.Duration {
135-
if c.heartbeatInterval <= 0 {
136-
return 30 * time.Second // Default heartbeat interval
137-
}
138135
return c.heartbeatInterval
139136
}
140137

0 commit comments

Comments
 (0)