From bdea7d5853e5cf85533ec250d1e96d2a048ffc9c Mon Sep 17 00:00:00 2001 From: Bradley Cicenas Date: Sat, 10 Jun 2017 10:46:16 -0300 Subject: [PATCH] remove containers from connector map on destroyed state --- connector/runc.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/connector/runc.go b/connector/runc.go index 1ab4f4b..0e890ca 100644 --- a/connector/runc.go +++ b/connector/runc.go @@ -84,6 +84,13 @@ func (cm *Runc) refresh(id string) { } c := cm.MustGet(id) + // remove container if entered destroyed state on last refresh + // this gives adequate time for the collector to be shut down + if c.GetMeta("state") == "destroyed" { + cm.delByID(id) + return + } + status, err := libc.Status() if err != nil { log.Warningf("failed to read status for container: %s\n", err) @@ -123,6 +130,7 @@ func (cm *Runc) refreshAll() { for id, _ := range cm.containers { cm.needsRefresh <- id } + log.Debugf("queued %d containers for refresh", len(cm.containers)) } func (cm *Runc) Loop() {