this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

BaseFeed: add helpers for transaction begin/commit and wal_checkpoint

+16
+16
feeds/__init__.py
··· 1 1 from datetime import datetime, timezone, timedelta 2 2 3 3 class BaseFeed: 4 + def __init__(self): 5 + self.in_transaction = False 6 + 4 7 def process_commit(self, commit): 5 8 raise NotImplementedError 6 9 ··· 46 49 return parsed 47 50 elif parsed > utc_now: 48 51 return utc_now 52 + 53 + def transaction_begin(self, db): 54 + if not self.in_transaction: 55 + db.execute('BEGIN') 56 + self.in_transaction = True 57 + 58 + def transaction_commit(self, db): 59 + if self.in_transaction: 60 + db.execute('COMMIT') 61 + self.in_transaction = False 62 + 63 + def wal_checkpoint(self, db, mode='PASSIVE'): 64 + db.pragma(f'wal_checkpoint({mode})')