From 81b8d9d5a9453a7e70717a6e3e4433f09cdcbe13 Mon Sep 17 00:00:00 2001 From: Donal Hurley Date: Thu, 17 Aug 2023 10:00:23 +0100 Subject: [PATCH] Fix issue where the reloadNginx function never finishes (#431) --- src/plugins/nginx.go | 7 +------ .../vendor/github.com/nginx/agent/v2/src/plugins/nginx.go | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/plugins/nginx.go b/src/plugins/nginx.go index 87c2bfcc2..de35f47da 100644 --- a/src/plugins/nginx.go +++ b/src/plugins/nginx.go @@ -631,9 +631,6 @@ func (n *Nginx) tailLog(logFile string, errorChannel chan string) { data := make(chan string, 1024) go t.Tail(ctx, data) - tick := time.NewTicker(n.config.Nginx.ConfigReloadMonitoringPeriod) - defer tick.Stop() - for { select { case d := <-data: @@ -648,10 +645,8 @@ func (n *Nginx) tailLog(logFile string, errorChannel chan string) { return } } - case <-tick.C: - errorChannel <- "" - return case <-ctx.Done(): + errorChannel <- "" return } } diff --git a/test/performance/vendor/github.com/nginx/agent/v2/src/plugins/nginx.go b/test/performance/vendor/github.com/nginx/agent/v2/src/plugins/nginx.go index 87c2bfcc2..de35f47da 100644 --- a/test/performance/vendor/github.com/nginx/agent/v2/src/plugins/nginx.go +++ b/test/performance/vendor/github.com/nginx/agent/v2/src/plugins/nginx.go @@ -631,9 +631,6 @@ func (n *Nginx) tailLog(logFile string, errorChannel chan string) { data := make(chan string, 1024) go t.Tail(ctx, data) - tick := time.NewTicker(n.config.Nginx.ConfigReloadMonitoringPeriod) - defer tick.Stop() - for { select { case d := <-data: @@ -648,10 +645,8 @@ func (n *Nginx) tailLog(logFile string, errorChannel chan string) { return } } - case <-tick.C: - errorChannel <- "" - return case <-ctx.Done(): + errorChannel <- "" return } }