From 1ed32b47843d3ec827ba8ed617151c759fc6b2c4 Mon Sep 17 00:00:00 2001 From: Ashutosh Narkar Date: Fri, 25 Mar 2022 14:15:55 -0700 Subject: [PATCH] plugins/logs: Fix broken retry logic We were incorrectly resetting the retry counter after every error condition instead of using the incremented value. As a result, retry delay would always be 0s. This meant that if OPA encountered an error while uploading decision logs it would immediately retry instead of doing an exponential backoff. Fixes: #4486 Signed-off-by: Ashutosh Narkar --- plugins/logs/plugin.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/logs/plugin.go b/plugins/logs/plugin.go index 07d5a639a0..4d012ee429 100644 --- a/plugins/logs/plugin.go +++ b/plugins/logs/plugin.go @@ -661,9 +661,10 @@ func (p *Plugin) loop() { ctx, cancel := context.WithCancel(context.Background()) + var retry int + for { - var retry int var waitC chan struct{} if *p.config.Reporting.Trigger == plugins.TriggerPeriodic && p.config.Service != "" {