this repo has no description

feeds: use in_transaction attribute of database connection

+2 -11
+2 -7
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 - 7 4 def process_commit(self, commit): 8 5 raise NotImplementedError 9 6 ··· 51 48 return utc_now 52 49 53 50 def transaction_begin(self, db): 54 - if not self.in_transaction: 51 + if not db.in_transaction: 55 52 db.execute('BEGIN') 56 - self.in_transaction = True 57 53 58 54 def transaction_commit(self, db): 59 - if self.in_transaction: 55 + if db.in_transaction: 60 56 db.execute('COMMIT') 61 - self.in_transaction = False 62 57 63 58 def wal_checkpoint(self, db, mode='PASSIVE'): 64 59 db.pragma(f'wal_checkpoint({mode})')
-2
feeds/popular.py
··· 9 9 FEED_URI = 'at://did:plc:4nsduwlpivpuur4mqkbfvm6a/app.bsky.feed.generator/popular' 10 10 11 11 def __init__(self): 12 - super().__init__() 13 - 14 12 self.db_cnx = apsw.Connection('db/popular.db') 15 13 self.db_cnx.pragma('journal_mode', 'WAL') 16 14 self.db_cnx.pragma('wal_autocheckpoint', '0')
-2
feeds/rapidfire.py
··· 11 11 FEED_URI = 'at://did:plc:4nsduwlpivpuur4mqkbfvm6a/app.bsky.feed.generator/rapidfire' 12 12 13 13 def __init__(self): 14 - super().__init__() 15 - 16 14 self.db_cnx = apsw.Connection('db/rapidfire.db') 17 15 self.db_cnx.pragma('journal_mode', 'WAL') 18 16 self.db_cnx.pragma('wal_autocheckpoint', '0')