Skip to content

Commit

Permalink
fix: do not cache result in State
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelapenya committed May 7, 2024
1 parent 6541a6b commit 1078bff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,14 @@ func (c *DockerContainer) Name(ctx context.Context) (string, error) {
return inspect.Name, nil
}

// State returns container's running state
// State returns container's running state. This method does not use the cache
// and always fetches the latest state from the Docker daemon.
func (c *DockerContainer) State(ctx context.Context) (*types.ContainerState, error) {
inspect, err := c.Inspect(ctx)
inspect, err := c.inspectRawContainer(ctx)
if err != nil {
if c.raw != nil {
return c.raw.State, err
}
return nil, err
}
return inspect.State, nil
Expand Down

0 comments on commit 1078bff

Please sign in to comment.