Skip to content

Commit

Permalink
Fall back to saved state when checking state db
Browse files Browse the repository at this point in the history
  • Loading branch information
sparrc committed Dec 7, 2022
1 parent 618408a commit f8a15f3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion agent/app/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const (
instanceIdBackoffMax = time.Second * 5
instanceIdBackoffJitter = 0.2
instanceIdBackoffMultiple = 1.3
instanceIdMaxRetryCount = 3
instanceIdMaxRetryCount = 5

targetLifecycleBackoffMin = time.Second
targetLifecycleBackoffMax = time.Second * 5
Expand Down Expand Up @@ -536,6 +536,10 @@ func (agent *ecsAgent) newTaskEngine(containerChangeEventStream *eventstream.Eve
}

currentEC2InstanceID := agent.getEC2InstanceID()
if currentEC2InstanceID == "" {
currentEC2InstanceID = savedData.ec2InstanceID
seelog.Warnf("Not able to get EC2 Instance ID from IMDS, using EC2 Instance ID from saved state: '%s'", currentEC2InstanceID)
}
if savedData.ec2InstanceID != "" && savedData.ec2InstanceID != currentEC2InstanceID {
seelog.Warnf(instanceIDMismatchErrorFormat,
savedData.ec2InstanceID, currentEC2InstanceID)
Expand Down

0 comments on commit f8a15f3

Please sign in to comment.