mirror of
https://github.com/containers/podman.git
synced 2025-06-17 06:57:43 +08:00
Make database write in syncContainer conditional
This should help with performance when executing many operations on a single container Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #185 Approved by: rhatdan
This commit is contained in:
@ -412,11 +412,16 @@ func (c *Container) syncContainer() error {
|
|||||||
// And then save back to disk
|
// And then save back to disk
|
||||||
if (c.state.State != ContainerStateUnknown) &&
|
if (c.state.State != ContainerStateUnknown) &&
|
||||||
(c.state.State != ContainerStateConfigured) {
|
(c.state.State != ContainerStateConfigured) {
|
||||||
|
oldState := c.state.State
|
||||||
|
// TODO: optionally replace this with a stat for the exit file
|
||||||
if err := c.runtime.ociRuntime.updateContainerStatus(c); err != nil {
|
if err := c.runtime.ociRuntime.updateContainerStatus(c); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := c.save(); err != nil {
|
// Only save back to DB if state changed
|
||||||
return err
|
if c.state.State != oldState {
|
||||||
|
if err := c.save(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user