Browse code

removing TODO, and explain why we can't filter by id on the matchevent method.

Signed-off-by: Yassine TIJANI <yasstij11@gmail.com>

Yassine TIJANI authored on 2017/05/25 00:22:09
Showing 1 changed files
... ...
@@ -28,11 +28,10 @@ const defaultGossipConvergeDelay = 2 * time.Second
28 28
 // Most operations against docker's API are done through the container name,
29 29
 // which is unique to the task.
30 30
 type controller struct {
31
-	task    *api.Task
32
-	adapter *containerAdapter
33
-	closed  chan struct{}
34
-	err     error
35
-
31
+	task       *api.Task
32
+	adapter    *containerAdapter
33
+	closed     chan struct{}
34
+	err        error
36 35
 	pulled     chan struct{} // closed after pull
37 36
 	cancelPull func()        // cancels pull context if not nil
38 37
 	pullErr    error         // pull error, only read after pulled closed
... ...
@@ -146,7 +145,6 @@ func (r *controller) Prepare(ctx context.Context) error {
146 146
 			}
147 147
 		}
148 148
 	}
149
-
150 149
 	if err := r.adapter.create(ctx); err != nil {
151 150
 		if isContainerCreateNameConflict(err) {
152 151
 			if _, err := r.adapter.inspect(ctx); err != nil {
... ...
@@ -564,15 +562,8 @@ func (r *controller) matchevent(event events.Message) bool {
564 564
 	if event.Type != events.ContainerEventType {
565 565
 		return false
566 566
 	}
567
-
568
-	// TODO(stevvooe): Filter based on ID matching, in addition to name.
569
-
570
-	// Make sure the events are for this container.
571
-	if event.Actor.Attributes["name"] != r.adapter.container.name() {
572
-		return false
573
-	}
574
-
575
-	return true
567
+	// we can't filter using id since it will have huge chances to introduce a deadlock. see #33377.
568
+	return event.Actor.Attributes["name"] == r.adapter.container.name()
576 569
 }
577 570
 
578 571
 func (r *controller) checkClosed() error {