agent/eventhandler/task_handler_types.go
func (event *sendableEvent) taskShouldBeSent() bool {
	event.lock.RLock()
	defer event.lock.RUnlock()

	if event.isContainerEvent {
		return false
	}
	tevent := event.taskChange
	if event.taskSent {
		return false // redundant event
	}

	// task and container change event should have task != nil
	if tevent.Task == nil {
		return false
	}

	// Task event should be sent
	if tevent.Task.GetSentStatus() < tevent.Status {
		return true
	}

	// Container event should be sent
	for _, containerStateChange := range tevent.Containers {
		container := containerStateChange.Container
		if container.GetSentStatus() < container.GetKnownStatus() {
			// We found a container that needs its state
			// change to be sent to ECS.
			return true
		}
	}

	return false
}
func (event *sendableEvent) taskShouldBeSent() bool {
	event.lock.RLock()
	defer event.lock.RUnlock()

	if event.isContainerEvent {
		return false
	}
	tevent := event.taskChange
	if event.taskSent {
		return false // redundant event
	}

	// task and container change event should have task != nil
	if tevent.Task == nil {
		return false
	}

	// Task event should be sent
	if tevent.Task.GetSentStatus() < tevent.Status {
		return true
	}

	// Container event should be sent
	for _, containerStateChange := range tevent.Containers {
		container := containerStateChange.Container
		if container.GetSentStatus() < container.GetKnownStatus() {
			// We found a container that needs its state
			// change to be sent to ECS.
			return true
		}
	}

	return false
}
func ( event * sendableEvent ) taskShouldBeSent ( ) bool { event . lock . RLock ( ) defer event . lock . RUnlock ( ) if event . isContainerEvent { return false } tevent := event . taskChange if event . taskSent { return false // redundant event } // task and container change event should have task != nil if tevent . Task == nil { return false } // Task event should be sent if tevent . Task . GetSentStatus ( ) < tevent . Status { return true } // Container event should be sent for _ , containerStateChange := range tevent . Containers { container := containerStateChange . Container if container . GetSentStatus ( ) < container . GetKnownStatus ( ) { // We found a container that needs its state // change to be sent to ECS. return true } } return false }
// taskShouldBeSent checks whether the event should be sent, this includes
// both task state change and container state change events
taskShouldBeSent checks whether the event should be sent this includes both task state change and container state change events