-
Notifications
You must be signed in to change notification settings - Fork 90
Open
Description
user = User.create(name: "test", email: "test@gmail.com")
user1 = User.fetch_by_uniq_keys(id: user.id)
user2 = User.fetch_by_uniq_keys(id: user.id)
user1.update_attribute(:name, "user1")
user2.update_attribute(:email, "user2@gmail.com")
user_from_cache = User.fetch_by_uniq_keys(id: user.id)
user_from_database = User.without_second_level_cache { User.find(user.id) }
assert_equal user_from_database.attributes, user_from_cache.attributes
------------------------------------------------------------------------------------------------------------------------------
bundle exec rake test result:
Failure:
FetchByUinqKeyTest#test_simulation_high_speed_update_same_record [/Code/second_level_cache/test/fetch_by_uniq_key_test.rb:111]:
--- expected
+++ actual
@@ -1 +1 @@
-{"id"=>2, "options"=>[], "json_options"=>nil, "extras"=>{}, "name"=>"user1", "email"=>"user2@gmail.com", "status"=>"active", "books_count"=>0, "images_count"=>0, "created_at"=>2021-01-29 06:42:26.331878 UTC, "updated_at"=>2021-01-29 06:42:28.335177 UTC}
+{"id"=>2, "options"=>[], "json_options"=>nil, "extras"=>{}, "name"=>"test", "email"=>"user2@gmail.com", "status"=>"active", "books_count"=>0, "images_count"=>0, "created_at"=>2021-01-29 06:42:26.331878 UTC, "updated_at"=>2021-01-29 06:42:28.335177 UTC}Metadata
Metadata
Assignees
Labels
No labels