Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Avoid locking account_data tables for upserts #2689

Merged
merged 1 commit into from
Nov 21, 2017

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Nov 16, 2017

No description provided.

txn.call_after(
self.get_global_account_data_by_type_for_user.invalidate,
self.get_account_data_for_user.invalidate((user_id,))
self.get_global_account_data_by_type_for_user.invalidate(
(account_data_type, user_id,)
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might need to think if its fine that the invalidation happens after another yield or not, I'm suspecting not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wondered that. But given there was no guarantee how quickly after the db update the invalidation was happening before, I couldn't see how it could make any difference. The extra yield is equivalent a sleep() in the db update thread before the call_after code returns.

Unless, of course, there's a race already, in which case yes this will make it worse...

@richvdh richvdh merged commit 0b4aa2d into develop Nov 21, 2017
@richvdh richvdh deleted the rav/unlock_account_data_upsert branch November 29, 2017 16:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants