1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-26 07:13:41 +01:00

fix: fixes a possible race condition (#2762)

This commit is contained in:
Amir Raminfar
2024-02-07 09:48:48 -08:00
committed by GitHub
parent 946f59e603
commit cd877c910c

View File

@@ -67,6 +67,13 @@ func (s *ContainerStore) init(ctx context.Context) {
stats := make(chan ContainerStat)
s.statsCollector.Subscribe(ctx, stats)
if containers, err := s.client.ListContainers(); err == nil {
for _, c := range containers {
c := c // create a new variable to avoid capturing the loop variable
s.containers.LoadOrStore(c.ID, &c)
}
}
for {
select {
case event := <-events: