From 25aa8ce9ac959d0e5a9d4787a69070ca9fe16ffc Mon Sep 17 00:00:00 2001 From: Jon Ayers Date: Wed, 14 Feb 2024 20:39:48 -0600 Subject: [PATCH] fix: keep sendLog async (#22) --- logger.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/logger.go b/logger.go index a74a4d7..2f3d75a 100644 --- a/logger.go +++ b/logger.go @@ -330,7 +330,11 @@ func (p *podEventLogger) sendLog(resourceName, token string, log agentsdk.Startu // If the logger was already closed, we await the close before // creating a new logger. This is to ensure all loggers get sent in order! _ = logger.closer.Close() - p.sendLog(resourceName, token, log) + go func() { + p.mutex.Lock() + defer p.mutex.Unlock() + p.sendLog(resourceName, token, log) + }() return } // We make this 5x the debounce because it's low-cost to persist a few