lib/cloud_powers/synapse/pipe/stream.rb in cloud_powers-1.0.1 vs lib/cloud_powers/synapse/pipe/stream.rb in cloud_powers-1.1.0

- old
+ new

@@ -15,20 +15,18 @@ def create_resource begin @response = kinesis.create_stream(config) kinesis.wait_until(:stream_exists, stream_name: config[:stream_name]) @response.successful? # (http request successful && stream created)? - rescue Exception => e - if e.kind_of? Aws::Kinesis::Errors::ResourceInUseException - logger.info "#{name} already created" - return if stream_status == 'ACTIVE' - logger.info "Not ready for traffic. Wait for 30 seconds..." - sleep 1 - @saved = true # acts like it would if it had to create the stream - @linked = true - else - raise - end + rescue Aws::Kinesis::Errors::ResourceInUseException => e + # TODO: write way more specs for these create methods. + # all of this logic is suspicious. + logger.info "#{name} already created" + return if stream_status == 'ACTIVE' + logger.info "Not ready for traffic..." + sleep 1 + @saved = true # acts like it would if it had to create the stream + @linked = true end end def config { stream_name: @name, shard_count: @shard_count }