Skip to content

Commit

Permalink
Skip sending internal task events to ECS control plane
Browse files Browse the repository at this point in the history
  • Loading branch information
chienhanlin committed Jun 29, 2023
1 parent d8d984b commit f6bd9a9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions agent/eventhandler/task_handler_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ func (event *sendableEvent) taskShouldBeSent() bool {
return false
}

// internal task state change does not need to be sent
if tevent.Task.IsInternal {
return false
}

// Task event should be sent
if tevent.Task.GetSentStatus() < tevent.Status {
return true
Expand Down
10 changes: 10 additions & 0 deletions agent/eventhandler/task_handler_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ func TestShouldTaskEventBeSent(t *testing.T) {
event *sendableEvent
shouldBeSent bool
}{
{
// We don't send a task event to backend if it is an internal task
event: newSendableTaskEvent(api.TaskStateChange{
Status: apitaskstatus.TaskRunning,
Task: &apitask.Task{
IsInternal: true,
},
}),
shouldBeSent: false,
},
{
// We don't send a task event to backend if task status == NONE
event: newSendableTaskEvent(api.TaskStateChange{
Expand Down

0 comments on commit f6bd9a9

Please sign in to comment.