From 6c01ba055a026afd06285af766477c55d231fb48 Mon Sep 17 00:00:00 2001 From: RRashmit Date: Thu, 5 Dec 2024 05:32:45 +0000 Subject: [PATCH] chore: review updates --- internal/collector/otel_collector_plugin.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/internal/collector/otel_collector_plugin.go b/internal/collector/otel_collector_plugin.go index 7e28175b9..5f81258f0 100644 --- a/internal/collector/otel_collector_plugin.go +++ b/internal/collector/otel_collector_plugin.go @@ -521,15 +521,12 @@ func (oc *Collector) updateTcplogReceivers(nginxConfigContext *model.NginxConfig } } - tcplogReceiverDeleted := oc.isNapReceiversDeleted(nginxConfigContext) - if !newTcplogReceiverAdded { - return tcplogReceiverDeleted - } + tcplogReceiverDeleted := oc.areNapReceiversDeleted(nginxConfigContext) - return newTcplogReceiverAdded + return newTcplogReceiverAdded || tcplogReceiverDeleted } -func (oc *Collector) isNapReceiversDeleted(nginxConfigContext *model.NginxConfigContext) bool { +func (oc *Collector) areNapReceiversDeleted(nginxConfigContext *model.NginxConfigContext) bool { listenAddressesToBeDeleted := oc.getConfigDeletedNapReceivers(nginxConfigContext) if len(listenAddressesToBeDeleted) != 0 { oc.deleteNapReceivers(listenAddressesToBeDeleted)