This is an automated email from the ASF dual-hosted git repository.
RongtongJin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git
The following commit(s) were added to refs/heads/master by this push:
new 9713aafb [Go] Fix double execution of telemetry command during
recovery (#1270)
9713aafb is described below
commit 9713aafb08107804aaf689622557414acfad2875
Author: guyinyou <[email protected]>
AuthorDate: Fri Jun 12 10:30:50 2026 +0800
[Go] Fix double execution of telemetry command during recovery (#1270)
When recovering from a telemetry stream error,
_execute_server_telemetry_command
was called both inside the `if cs.recovering` block (on successful
heartbeat)
and again unconditionally after the block, causing the command to be
executed
twice.
Remove the call inside the recovering block since the response should be
executed unconditionally once successfully received, regardless of recovery
state.
Affected: client.go startUp()
Co-authored-by: guyinyou <[email protected]>
---
golang/client.go | 3 +--
golang/client_test.go | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/golang/client.go b/golang/client.go
index 04ec6657..471541d4 100644
--- a/golang/client.go
+++ b/golang/client.go
@@ -144,8 +144,7 @@ func (cs *defaultClientSession) startUp() {
// we assume that the list of the servers
hasn't changed, so the server that sent the message is still present.
hearbeat_response, err :=
cs.cli.clientManager.HeartBeat(context.TODO(), cs.endpoints,
&v2.HeartbeatRequest{}, 10*time.Second)
if err == nil && hearbeat_response.Status.Code
== v2.Code_OK {
- cs.cli.log.Info("Managed to recover,
executing message")
-
cs._execute_server_telemetry_command(response)
+ cs.cli.log.Info("Managed to recover")
} else {
cs.cli.log.Errorf("Failed to recover,
Some of the servers are unhealthy, Heartbeat err=%w", err)
cs.release()
diff --git a/golang/client_test.go b/golang/client_test.go
index f176b736..bcd75ad3 100644
--- a/golang/client_test.go
+++ b/golang/client_test.go
@@ -268,7 +268,7 @@ func TestRestoreDefaultClientSessionOneError(t *testing.T) {
sugarBaseLogger.Info(observedLogs.All())
commandExecutionLog := observedLogs.All()[:3]
assert.Equal(t, "Encountered error while receiving TelemetryCommand,
trying to recover, err=EOF", commandExecutionLog[0].Message)
- assert.Equal(t, "Managed to recover, executing message",
commandExecutionLog[1].Message)
+ assert.Equal(t, "Managed to recover", commandExecutionLog[1].Message)
assert.Equal(t, "Executed command successfully",
commandExecutionLog[2].Message)
}