From d46083a8e0535ff14897afdef4179376603d54f0 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Tue, 5 Dec 2023 13:45:40 +0000 Subject: [PATCH] fix: surround `agentTokenToLogger` with mutex Fixes #15 --- logger.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/logger.go b/logger.go index 4175990..f6d8909 100644 --- a/logger.go +++ b/logger.go @@ -300,7 +300,9 @@ func (p *podEventLogger) init() error { // If a logger already exists for the token, it's returned. Otherwise a new // logger is created and returned. func (p *podEventLogger) sendLog(resourceName, token string, log agentsdk.StartupLog) { + p.mutex.Lock() logger, ok := p.agentTokenToLogger[token] + p.mutex.Unlock() if !ok { client := agentsdk.New(p.coderURL) client.SetSessionToken(token)