agent/api/statechange.go
func (change *TaskStateChange) ShouldBeReported() bool {
	// Events that should be reported:
	// 1. Normal task state change: RUNNING/STOPPED
	// 2. Container state change, with task status in CREATED/RUNNING/STOPPED
	// The task timestamp will be sent in both of the event type
	// TODO Move the Attachment statechange check into this method
	if change.Status == apitaskstatus.TaskRunning || change.Status == apitaskstatus.TaskStopped {
		return true
	}

	if len(change.Containers) != 0 {
		return true
	}

	return false
}
func (change *TaskStateChange) ShouldBeReported() bool {
	// Events that should be reported:
	// 1. Normal task state change: RUNNING/STOPPED
	// 2. Container state change, with task status in CREATED/RUNNING/STOPPED
	// The task timestamp will be sent in both of the event type
	// TODO Move the Attachment statechange check into this method
	if change.Status == apitaskstatus.TaskRunning || change.Status == apitaskstatus.TaskStopped {
		return true
	}

	if len(change.Containers) != 0 {
		return true
	}

	return false
}
func ( change * TaskStateChange ) ShouldBeReported ( ) bool { // Events that should be reported: // 1. Normal task state change: RUNNING/STOPPED // 2. Container state change, with task status in CREATED/RUNNING/STOPPED // The task timestamp will be sent in both of the event type // TODO Move the Attachment statechange check into this method if change . Status == apitaskstatus . TaskRunning || change . Status == apitaskstatus . TaskStopped { return true } if len ( change . Containers ) != 0 { return true } return false }
// ShouldBeReported checks if the statechange should be reported to backend
ShouldBeReported checks if the statechange should be reported to backend