this repo has no description
0
fork

Configure Feed

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

Make CAR parsing optional

+6 -4
+1 -1
bsky-activity.py
··· 45 45 sys.stdout.flush() 46 46 47 47 op_count = 0 48 - for commit, op in subscribe_commits(redis_cnx): 48 + for commit, op in subscribe_commits(redis_cnx, parse_car_blocks=False): 49 49 if op['action'] != 'create': 50 50 continue 51 51
+5 -3
firehose_utils.py
··· 3 3 from atproto import CAR 4 4 from io import BytesIO 5 5 6 - def subscribe_commits(redis_cnx=None): 6 + def subscribe_commits(redis_cnx=None, parse_car_blocks=False): 7 7 if redis_cnx is None: 8 8 redis_cnx = redis.Redis() 9 9 redis_sub = redis_cnx.pubsub(ignore_subscribe_messages=True) ··· 22 22 23 23 # TODO(ejd): figure out how to validate blocks 24 24 blocks = payload.pop('blocks') 25 - car_parsed = CAR.from_bytes(blocks) 25 + if parse_car_blocks: 26 + car_parsed = CAR.from_bytes(blocks) 26 27 27 28 message = payload.copy() 28 29 del message['ops'] ··· 32 33 op = commit_op.copy() 33 34 if op['cid'] is not None: 34 35 op['cid'] = op['cid'].encode('base32') 35 - op['record'] = car_parsed.blocks[op['cid']] 36 + if parse_car_blocks: 37 + op['record'] = car_parsed.blocks[op['cid']] 36 38 yield message, op