Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Unreleased Changes
------------------

* Issue - Use configured clients for batch reads in `find_all`.

2.13.3 (2025-01-02)
------------------

Expand Down
6 changes: 3 additions & 3 deletions lib/aws-record/record/item_operations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ def find_with_opts(opts)
# include all the keys defined in model.
# @raise [ArgumentError] if the provided keys are a duplicate.
def find_all(keys)
Aws::Record::Batch.read do |db|
Aws::Record::Batch.read(client: dynamodb_client) do |db|
keys.each do |key|
db.find(self, key)
end
Expand Down Expand Up @@ -631,8 +631,8 @@ def _build_update_expression(attr_value_pairs)
end
end
update_expressions = []
update_expressions << ("SET #{set_expressions.join(', ')}") unless set_expressions.empty?
update_expressions << ("REMOVE #{remove_expressions.join(', ')}") unless remove_expressions.empty?
update_expressions << "SET #{set_expressions.join(', ')}" unless set_expressions.empty?
update_expressions << "REMOVE #{remove_expressions.join(', ')}" unless remove_expressions.empty?
{
update_expression: update_expressions.join(' '),
expression_attribute_names: exp_attr_names,
Expand Down
7 changes: 5 additions & 2 deletions spec/aws-record/record/item_operations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,12 @@ module Record
]
end

it 'passes the correct class and key arguments to BatchRead' do
it 'passes the correct client, class and key arguments to BatchRead' do
klass.configure_client(client: stub_client)
mock_batch_read = double
expect(Batch).to receive(:read).and_yield(mock_batch_read).and_return(mock_batch_read)
expect(Batch).to receive(:read)
.with(client: klass.dynamodb_client)
.and_yield(mock_batch_read).and_return(mock_batch_read)
keys.each do |key|
expect(mock_batch_read).to receive(:find).with(klass, key)
end
Expand Down