ps: do not sync container

Do not sync containers with the runtime and the database when listing
containers.  It turns out to be extremely expensive and unnecessary.

The sync was needed since listing all containers from the database did
not populate their state.  Doing that, however, is much faster since we
already have a connection to the database.

This change makes listing 200 containers 2 times faster than before.

[NO NEW TESTS NEEDED]

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2023-01-25 09:21:14 +01:00
parent 4cd7f6354b
commit 6132c4d548
3 changed files with 34 additions and 38 deletions

View File

@ -829,10 +829,6 @@ func (c *Container) Batch(batchFunc func(*Container) error) error {
c.lock.Lock()
defer c.lock.Unlock()
if err := c.syncContainer(); err != nil {
return err
}
newCtr := new(Container)
newCtr.config = c.config
newCtr.state = c.state