mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 02:00:43 +00:00
Maintain container-by-pid index correctly.
This commit is contained in:
@@ -252,11 +252,17 @@ func (r *registry) updateContainerState(containerID string) {
|
||||
if !ok {
|
||||
c = NewContainerStub(dockerContainer)
|
||||
r.containers[containerID] = c
|
||||
r.containersByPID[dockerContainer.State.Pid] = c
|
||||
} else {
|
||||
// potentially remove existing pid mapping.
|
||||
delete(r.containersByPID, c.PID())
|
||||
c.UpdateState(dockerContainer)
|
||||
}
|
||||
|
||||
// Update PID index
|
||||
if c.PID() > 1 {
|
||||
r.containersByPID[c.PID()] = c
|
||||
}
|
||||
|
||||
// Trigger anyone watching for updates
|
||||
for _, f := range r.watchers {
|
||||
f(c)
|
||||
|
||||
Reference in New Issue
Block a user