resources: aws: ec2: Fix closed channel handling

If awschan closes, longpollWatch and snsWatch return nil
instead of an error. This will prevent the engine from
shutting down in case we choose to close the channel
early or from other struct methods.
This commit is contained in:
jonathangold
2018-01-06 15:09:13 -05:00
parent c455ef2c62
commit 3c677543e0

View File

@@ -469,7 +469,7 @@ func (obj *AwsEc2Res) longpollWatch() error {
}
case msg, ok := <-obj.awsChan:
if !ok {
return fmt.Errorf("channel closed unexpectedly")
return nil
}
if err := msg.err; err != nil {
return err
@@ -650,7 +650,7 @@ func (obj *AwsEc2Res) snsWatch() error {
}
case msg, ok := <-obj.awsChan:
if !ok {
return *exit
return nil
}
if err := msg.err; err != nil {
return err