this repo has no description
0
fork

Configure Feed

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

Add logging to FirehoseManager

+7
+7
firehose_manager.py
··· 1 1 import apsw 2 + import logging 2 3 3 4 class FirehoseManager: 4 5 def __init__(self, fname='firehose.db'): ··· 7 8 with self.db_cnx: 8 9 self.db_cnx.execute("create table if not exists firehose(key text unique, value text)") 9 10 11 + self.logger = logging.getLogger('feeds.firehose') 12 + 10 13 def get_sequence_number(self): 11 14 cur = self.db_cnx.execute("select * from firehose where key = 'seq'") 12 15 row = cur.fetchone() ··· 16 19 return int(value) 17 20 18 21 def set_sequence_number(self, value): 22 + self.logger.debug(f'setting sequence number = {value}') 23 + 19 24 with self.db_cnx: 20 25 self.db_cnx.execute( 21 26 "insert into firehose (key, value) values ('seq', :value) on conflict(key) do update set value = :value", 22 27 dict(value=value) 23 28 ) 29 + 30 + self.db_cnx.pragma('wal_checkpoint(TRUNCATE)')