Skip to content

Instantly share code, notes, and snippets.

@elliotchance
Created December 4, 2019 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elliotchance/41d1cd78838ecd73b84cc2372ea69c10 to your computer and use it in GitHub Desktop.
Save elliotchance/41d1cd78838ecd73b84cc2372ea69c10 to your computer and use it in GitHub Desktop.
class RepeatableReadTransaction(ReadCommittedTransaction):
def record_is_locked(self, record):
return ReadCommittedTransaction.record_is_locked(self, record) or \
self.table.locks.exists(self, record['id'])
def record_is_visible(self, record):
is_visible = ReadCommittedTransaction.record_is_visible(self, record)
if is_visible:
self.table.locks.add(self, record['id'])
return is_visible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment