Skip to content

Commit

Permalink
fix: surround agentTokenToLogger with mutex
Browse files Browse the repository at this point in the history
Fixes #15
  • Loading branch information
kylecarbs authored and sreya committed Feb 9, 2024
1 parent b661fb8 commit d46083a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d46083a

Please sign in to comment.