From ac80cad7a52452371b1da49730496f3e8b822d5c Mon Sep 17 00:00:00 2001 From: Alex Tymchuk Date: Tue, 19 Sep 2023 08:28:10 +0000 Subject: [PATCH] PMM-12375 do not update if version is empty --- managed/services/agents/channel/channel.go | 2 +- managed/services/agents/service_info_broker.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/managed/services/agents/channel/channel.go b/managed/services/agents/channel/channel.go index 5eec34e666..9153066248 100644 --- a/managed/services/agents/channel/channel.go +++ b/managed/services/agents/channel/channel.go @@ -201,7 +201,7 @@ func (c *Channel) send(msg *agentpb.ServerMessage) { atomic.AddUint32(&c.mSent, 1) } -// runReader receives messages from server. +// runReceiver receives messages from server. func (c *Channel) runReceiver() { defer func() { close(c.requests) diff --git a/managed/services/agents/service_info_broker.go b/managed/services/agents/service_info_broker.go index 3513dcb0af..4223365a7f 100644 --- a/managed/services/agents/service_info_broker.go +++ b/managed/services/agents/service_info_broker.go @@ -197,8 +197,12 @@ func updateServiceVersion(ctx context.Context, q *reform.Querier, resp agentpb.A l := logger.Get(ctx) version := resp.(*agentpb.ServiceInfoResponse).GetVersion() //nolint:forcetypeassert - service.Version = version + if version == "" { + return nil + } + l.Debugf("Updating service version: %s.", version) + service.Version = version if err := q.Update(service); err != nil { return errors.Wrap(err, "failed to update service version") }