Skip to content

Commit

Permalink
Adds nullish coalescing to output of Aws::SQS::Client#receive_message…
Browse files Browse the repository at this point in the history
… to an empty array (#753)
  • Loading branch information
mkeemon authored Nov 23, 2023
1 parent d65636e commit c966255
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ gemspec
group :test do
gem 'activejob'
gem 'aws-sdk-core', '~> 3'
gem 'aws-sdk-sqs'
# Pin to 1.65.0 because of below issues:
# - https://github.com/ruby-shoryuken/shoryuken/pull/753#issuecomment-1822720647
# - https://github.com/getmoto/moto/issues/7054
gem 'aws-sdk-sqs', '1.65.0'
gem 'codeclimate-test-reporter', require: nil
gem 'httparty'
gem 'multi_xml'
Expand Down
2 changes: 1 addition & 1 deletion bin/cli/sqs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def find_all(url, limit)
max_number_of_messages: batch_size,
attribute_names: ['All'],
message_attribute_names: ['All']
).messages
).messages || []

messages.each { |m| yield m }

Expand Down
3 changes: 2 additions & 1 deletion lib/shoryuken/queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def send_messages(options)
end

def receive_messages(options)
client.receive_message(options.merge(queue_url: url)).messages.map { |m| Message.new(client, self, m) }
messages = client.receive_message(options.merge(queue_url: url)).messages || []
messages.map { |m| Message.new(client, self, m) }
end

def fifo?
Expand Down

0 comments on commit c966255

Please sign in to comment.