Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch Get making multiple calls even for smaller batches #240

Closed
lzrf0cuz opened this issue Jul 2, 2024 · 3 comments
Closed

Batch Get making multiple calls even for smaller batches #240

lzrf0cuz opened this issue Jul 2, 2024 · 3 comments

Comments

@lzrf0cuz
Copy link

lzrf0cuz commented Jul 2, 2024

Given the below input, Batch Get makes multiple calls even when the number of dynamo.Keys are less than 100. They were tested with two dynamo.Keys, where the first set exists and the second doesn't.

[]dynamo.Keys{{mockPKValue1, mockSKValue1}, {mockPKValue2, mockSKValue2}} There are 2 sets here. When the BatchGet.All method is executed, 2 separate calls are made even though the keys belong to the same table and the batch size is only 2.

Adding in.RequestItems[table] = kas after line 234 in https://github.com/guregu/dynamo/blob/master/batchget.go#L234 seems to mitigate it.

I encountered this after migrating to V2.

@guregu
Copy link
Owner

guregu commented Jul 3, 2024

Nice catch, thanks. In v1 the KeysAndAttributes SDK type is a pointer so that's probably where the issue came from. I'll take a look

guregu added a commit that referenced this issue Jul 3, 2024
@guregu
Copy link
Owner

guregu commented Jul 3, 2024

Just released v2.0.2 including this fix, thanks!

Note to self: add request count test after #238 is implemented

@lzrf0cuz
Copy link
Author

lzrf0cuz commented Jul 3, 2024

Thanks for the quick release.

@lzrf0cuz lzrf0cuz closed this as completed Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants