Skip to content

Commit

Permalink
fix: BatchRead for multiple records with operations
Browse files Browse the repository at this point in the history
  • Loading branch information
opti committed Oct 11, 2024
1 parent 7b7ace9 commit 2b16321
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/aerospike/batch_read.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def self.ops(key, ops, opt = {})
# For internal use only.
def ==(other) # :nodoc:
other && other.instance_of?(self.class) &&
@bin_names.sort == other.bin_names.sort && @ops.sort == other.ops.sort &&
@bin_names&.sort == other.bin_names&.sort && @ops == other.ops &&
@policy == other.policy && @read_all_bins == other.read_all_bins
end

Expand Down
7 changes: 6 additions & 1 deletion spec/aerospike/batch_operate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,16 @@
Aerospike::Operation.get("idx"),
Aerospike::Operation.get("rnd")
]
records = [Aerospike::BatchRead.ops(keys.first, ops)]
records = [
Aerospike::BatchRead.ops(keys.first, ops),
Aerospike::BatchRead.ops(keys.last, ops)
]
client.batch_operate(records, batch_policy)

expect(records[0].result_code).to eql(0)
expect(records[1].result_code).to eql(0)
expect(records[0].record.bins).to eql({ "idx"=>0, "rnd"=>99 })
expect(records[1].record.bins).to eql({ "idx"=>2, "rnd"=>99 })
end

it 'filter out' do
Expand Down

0 comments on commit 2b16321

Please sign in to comment.