Skip to content

Commit a32b9ea

Browse files
committed
Delete dead code in instance_queries.go
1 parent ba535a5 commit a32b9ea

File tree

1 file changed

+0
-35
lines changed

1 file changed

+0
-35
lines changed

core/instance_queries.go

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"path/filepath"
1212
"sort"
1313
"strings"
14-
"time"
1514

1615
"github.com/aws/aws-sdk-go/aws"
1716
"github.com/aws/aws-sdk-go/service/ec2"
@@ -412,37 +411,3 @@ func (i *instance) isUnattachedSpotInstanceLaunchedForAnEnabledASG() bool {
412411
}
413412
return false
414413
}
415-
416-
// returns an instance ID as *string, set to nil if we need to wait for the next
417-
// run in case there are no spot instances
418-
func (i *instance) isReadyToAttach(asg *autoScalingGroup) bool {
419-
420-
log.Println("Considering ", *i.InstanceId, "for attaching to", asg.name)
421-
422-
gracePeriod := *asg.HealthCheckGracePeriod
423-
424-
instanceUpTime := time.Now().Unix() - i.LaunchTime.Unix()
425-
426-
log.Println("Instance uptime:", time.Duration(instanceUpTime)*time.Second)
427-
428-
// Check if the spot instance is out of the grace period, so in that case we
429-
// can replace an on-demand instance with it
430-
if *i.State.Name == ec2.InstanceStateNameRunning &&
431-
instanceUpTime > gracePeriod {
432-
log.Println("The spot instance", *i.InstanceId,
433-
" has passed grace period and is ready to attach to the group.")
434-
return true
435-
} else if *i.State.Name == ec2.InstanceStateNameRunning &&
436-
instanceUpTime < gracePeriod {
437-
log.Println("The spot instance", *i.InstanceId,
438-
"is still in the grace period,",
439-
"waiting for it to be ready before we can attach it to the group...")
440-
return false
441-
} else if *i.State.Name == ec2.InstanceStateNamePending {
442-
log.Println("The spot instance", *i.InstanceId,
443-
"is still pending,",
444-
"waiting for it to be running before we can attach it to the group...")
445-
return false
446-
}
447-
return false
448-
}

0 commit comments

Comments
 (0)