mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Use mark and sweep for exec command removal
This takes the final removal for exec commands in two steps. The first GC tick will mark the exec commands for removal and then the second tick will remove the config from the daemon. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
5f017bba48
commit
34ab8c4326
1 changed files with 7 additions and 3 deletions
|
@ -28,6 +28,7 @@ type execConfig struct {
|
|||
OpenStderr bool
|
||||
OpenStdout bool
|
||||
Container *Container
|
||||
canRemove bool
|
||||
}
|
||||
|
||||
type execStore struct {
|
||||
|
@ -256,12 +257,15 @@ func (d *Daemon) execCommandGC() {
|
|||
var (
|
||||
cleaned int
|
||||
liveExecCommands = d.containerExecIds()
|
||||
ids = d.execCommands.List()
|
||||
)
|
||||
for _, id := range ids {
|
||||
if _, exists := liveExecCommands[id]; !exists {
|
||||
for id, config := range d.execCommands.s {
|
||||
if config.canRemove {
|
||||
cleaned++
|
||||
d.execCommands.Delete(id)
|
||||
} else {
|
||||
if _, exists := liveExecCommands[id]; !exists {
|
||||
config.canRemove = true
|
||||
}
|
||||
}
|
||||
}
|
||||
logrus.Debugf("clean %d unused exec commands", cleaned)
|
||||
|
|
Loading…
Reference in a new issue