Dynamoid / dynamoid

Ruby ORM for Amazon's DynamoDB.
MIT License
580 stars 195 forks source link

`reload` doesn't reset `new_record` #564

Closed rahul342 closed 2 years ago

rahul342 commented 2 years ago

If there are concurrent requests both trying to create document with same primary key, only one of them will go through and not overwrite due to conditional expression check in save. This is great!

If the failed concurrent request then tries to reload to get the latest record, it does get all the attributes except @new_record is not set to false causing Dynamoid::Errors::RecordNotUnique again.

Is this intentional?

andrykonchin commented 2 years ago

No, it isn't intentional behavior. It's a bug.

Will fix it. Thank you for reporting.