diff --git a/cmd/algod/main.go b/cmd/algod/main.go index 68d809fd88..cb0960e61b 100644 --- a/cmd/algod/main.go +++ b/cmd/algod/main.go @@ -344,7 +344,17 @@ func run() int { // Send a heartbeat event every 10 minutes as a sign of life go func() { - ticker := time.NewTicker(10 * time.Minute) + var interval time.Duration + defaultIntervalSecs := config.GetDefaultLocal().HeartbeatUpdateInterval + switch { + case cfg.HeartbeatUpdateInterval <= 0: // use default + interval = time.Second * time.Duration(defaultIntervalSecs) + case cfg.HeartbeatUpdateInterval < 60: // min frequency 1 minute + interval = time.Minute + default: + interval = time.Second * time.Duration(cfg.HeartbeatUpdateInterval) + } + ticker := time.NewTicker(interval) defer ticker.Stop() sendHeartbeat := func() { diff --git a/config/localTemplate.go b/config/localTemplate.go index 32e071c79e..4be9e300fe 100644 --- a/config/localTemplate.go +++ b/config/localTemplate.go @@ -261,6 +261,10 @@ type Local struct { // telemetry ( when enabled ). Defined in seconds. PeerConnectionsUpdateInterval int `version[5]:"3600"` + // HeartbeatUpdateInterval defines the interval at which the heartbeat information is being sent to the + // telemetry ( when enabled ). Defined in seconds. Minimum value is 60. + HeartbeatUpdateInterval int `version[27]:"600"` + // EnableProfiler enables the go pprof endpoints, should be false if // the algod api will be exposed to untrusted individuals EnableProfiler bool `version[0]:"false"` diff --git a/config/local_defaults.go b/config/local_defaults.go index 6cb731e792..b9a993631f 100644 --- a/config/local_defaults.go +++ b/config/local_defaults.go @@ -79,6 +79,7 @@ var defaultLocal = Local{ ForceFetchTransactions: false, ForceRelayMessages: false, GossipFanout: 4, + HeartbeatUpdateInterval: 600, IncomingConnectionsLimit: 800, IncomingMessageFilterBucketCount: 5, IncomingMessageFilterBucketSize: 512, diff --git a/installer/config.json.example b/installer/config.json.example index 5587072167..59150b031b 100644 --- a/installer/config.json.example +++ b/installer/config.json.example @@ -58,6 +58,7 @@ "ForceFetchTransactions": false, "ForceRelayMessages": false, "GossipFanout": 4, + "HeartbeatUpdateInterval": 600, "IncomingConnectionsLimit": 800, "IncomingMessageFilterBucketCount": 5, "IncomingMessageFilterBucketSize": 512, diff --git a/test/testdata/configs/config-v27.json b/test/testdata/configs/config-v27.json index 99c797da3f..375c6f8712 100644 --- a/test/testdata/configs/config-v27.json +++ b/test/testdata/configs/config-v27.json @@ -59,6 +59,7 @@ "ForceFetchTransactions": false, "ForceRelayMessages": false, "GossipFanout": 4, + "HeartbeatUpdateInterval": 600, "IncomingConnectionsLimit": 800, "IncomingMessageFilterBucketCount": 5, "IncomingMessageFilterBucketSize": 512,