From 3c677543e089df0c4f0c8bf809512348f23780ea Mon Sep 17 00:00:00 2001 From: jonathangold Date: Sat, 6 Jan 2018 15:09:13 -0500 Subject: [PATCH] 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. --- resources/aws_ec2.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/aws_ec2.go b/resources/aws_ec2.go index 1928058f..6fa0e32b 100644 --- a/resources/aws_ec2.go +++ b/resources/aws_ec2.go @@ -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