Skip to content

Commit

Permalink
fix: avoid deadlocks when Docker is not available (#1645)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelapenya committed Sep 20, 2023
1 parent fe847d2 commit 3d5837d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docker_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ func (c *DockerClient) Info(ctx context.Context) (types.Info, error) {
dockerInfoOnce.Do(func() {
dockerInfo, err = c.Client.Info(ctx)
if err != nil {
// reset the state of the sync.Once so that the next call to Info will try again
dockerInfoOnce = sync.Once{}
return
}

Expand All @@ -66,6 +64,11 @@ func (c *DockerClient) Info(ctx context.Context) (types.Info, error) {
)
})

if err != nil {
// reset the state of the sync.Once so that the next call to Info will try again
dockerInfoOnce = sync.Once{}
}

return dockerInfo, err
}

Expand Down

0 comments on commit 3d5837d

Please sign in to comment.