Don't send exit event on failure
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
		@@ -9,9 +9,10 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
type DeleteTask struct {
 | 
					type DeleteTask struct {
 | 
				
			||||||
	baseTask
 | 
						baseTask
 | 
				
			||||||
	ID     string
 | 
						ID      string
 | 
				
			||||||
	Status int
 | 
						Status  int
 | 
				
			||||||
	PID    string
 | 
						PID     string
 | 
				
			||||||
 | 
						NoEvent bool
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *Supervisor) delete(t *DeleteTask) error {
 | 
					func (s *Supervisor) delete(t *DeleteTask) error {
 | 
				
			||||||
@@ -20,13 +21,15 @@ func (s *Supervisor) delete(t *DeleteTask) error {
 | 
				
			|||||||
		if err := s.deleteContainer(i.container); err != nil {
 | 
							if err := s.deleteContainer(i.container); err != nil {
 | 
				
			||||||
			logrus.WithField("error", err).Error("containerd: deleting container")
 | 
								logrus.WithField("error", err).Error("containerd: deleting container")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		s.notifySubscribers(Event{
 | 
							if !t.NoEvent {
 | 
				
			||||||
			Type:      "exit",
 | 
								s.notifySubscribers(Event{
 | 
				
			||||||
			Timestamp: time.Now(),
 | 
									Type:      "exit",
 | 
				
			||||||
			ID:        t.ID,
 | 
									Timestamp: time.Now(),
 | 
				
			||||||
			Status:    t.Status,
 | 
									ID:        t.ID,
 | 
				
			||||||
			PID:       t.PID,
 | 
									Status:    t.Status,
 | 
				
			||||||
		})
 | 
									PID:       t.PID,
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		ContainersCounter.Dec(1)
 | 
							ContainersCounter.Dec(1)
 | 
				
			||||||
		ContainerDeleteTimer.UpdateSince(start)
 | 
							ContainerDeleteTimer.UpdateSince(start)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,7 +46,8 @@ func (w *worker) Start() {
 | 
				
			|||||||
			}).Error("containerd: start container")
 | 
								}).Error("containerd: start container")
 | 
				
			||||||
			t.Err <- err
 | 
								t.Err <- err
 | 
				
			||||||
			evt := &DeleteTask{
 | 
								evt := &DeleteTask{
 | 
				
			||||||
				ID: t.Container.ID(),
 | 
									ID:      t.Container.ID(),
 | 
				
			||||||
 | 
									NoEvent: true,
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			w.s.SendTask(evt)
 | 
								w.s.SendTask(evt)
 | 
				
			||||||
			continue
 | 
								continue
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user