-
Notifications
You must be signed in to change notification settings - Fork 613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check the sentstatus before updating #1383
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have a couple of minor comments. Can you please add unit tests for this as well?
@@ -186,14 +186,16 @@ type setStatusSent func(event *sendableEvent) | |||
|
|||
// setContainerChangeSent sets the event's container change object as sent | |||
func setContainerChangeSent(event *sendableEvent) { | |||
if event.containerChange.Container != nil { | |||
if event.containerChange.Container != nil && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you just assign event.containerChange.Container
to a var and reuse it in this method so that it's easier to read this code?
event.containerChange.Container.SetSentStatus(event.containerChange.Status) | ||
} | ||
} | ||
|
||
// setTaskChangeSent sets the event's task change object as sent | ||
func setTaskChangeSent(event *sendableEvent) { | ||
if event.taskChange.Task != nil { | ||
if event.taskChange.Task != nil && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you just assign event.taskChange.Task
to a var and reuse it in this method so that it's easier to read this code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some minor comments. Please fix them before merging.
if event.containerChange.Container != nil { | ||
event.containerChange.Container.SetSentStatus(event.containerChange.Status) | ||
containerChangeStatus := event.containerChange.Status | ||
if event.containerChange.Container != nil && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
event.containerChange.Container
can be a var as well
if event.taskChange.Task != nil { | ||
event.taskChange.Task.SetSentStatus(event.taskChange.Status) | ||
taskChangeStatus := event.taskChange.Status | ||
if event.taskChange.Task != nil && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
event.taskChange.Task
can be a var as well
There could be a case that SubmitTaskStateChange for STOPPED happened before RUNNING, where the sentstatus of the task would be set to RUNNING. This PR fix this by checking the sentstatus before updating.
There could be a case that SubmitTaskStateChange for STOPPED happened
before RUNNING, where the sentstatus of the task would be set to
RUNNING. This PR fix this by checking the sentstatus before updating.
Summary
Implementation details
Testing
make release
)go build -out amazon-ecs-agent.exe ./agent
)make test
) passgo test -timeout=25s ./agent/...
) passmake run-integ-tests
) pass.\scripts\run-integ-tests.ps1
) passmake run-functional-tests
) pass.\scripts\run-functional-tests.ps1
) passNew tests cover the changes:
Description for the changelog
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.