Skip to content

Commit

Permalink
Merge pull request #51 from hairyhenderson/start-faster-please
Browse files Browse the repository at this point in the history
Make things start faster
  • Loading branch information
hairyhenderson authored Jun 21, 2016
2 parents 29fd044 + 524d18b commit 2129d67
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions aws/ec2info.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

// Ec2Info -
type Ec2Info struct {
describer InstanceDescriber
describer func() InstanceDescriber
metaClient *Ec2Meta
}

Expand All @@ -17,14 +17,14 @@ type InstanceDescriber interface {
DescribeInstances(*ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)
}

// var _ InstanceDescriber = (*ec2.EC2)(nil)

// NewEc2Info -
func NewEc2Info() *Ec2Info {
metaClient := &Ec2Meta{}
region := metaClient.Region()
return &Ec2Info{
describer: ec2Client(region),
describer: func() InstanceDescriber {
region := metaClient.Region()
return ec2Client(region)
},
metaClient: metaClient,
}
}
Expand All @@ -42,7 +42,7 @@ func (e *Ec2Info) Tag(tag string, def ...string) string {
input := &ec2.DescribeInstancesInput{
InstanceIds: aws.StringSlice([]string{instanceID}),
}
output, err := e.describer.DescribeInstances(input)
output, err := e.describer().DescribeInstances(input)
if err != nil {
return returnDefault(def)
}
Expand Down

0 comments on commit 2129d67

Please sign in to comment.