Skip to content

Commit

Permalink
atproto_firehose: handle errors decoding bad DAG-CBOR blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed May 19, 2024
1 parent 91ffffc commit 8e670da
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions atproto_firehose.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _load_dids():
bridged_dids.update(new_bridged)

dids_initialized.set()
logger.info(f'DIDs: ATProto {len(atproto_dids)} (+{len(new_atproto)}, AtpRepo{len(bridged_dids)} (+{len(new_bridged)})')
logger.info(f'DIDs: ATProto {len(atproto_dids)} (+{len(new_atproto)}, AtpRepo {len(bridged_dids)} (+{len(new_bridged)})')


def subscriber():
Expand Down Expand Up @@ -169,7 +169,14 @@ def subscribe():
if not cid or not block:
continue

op = Op(*op[:-1], record=block.decoded)
try:
op = Op(*op[:-1], record=block.decoded)
except BaseException:
# https://github.com/hashberg-io/dag-cbor/issues/14
logger.error(f"Couldn't decode block {cid} seq {op.seq}",
exc_info=True)
continue

type = op.record.get('$type')
if not type:
logger.warning('commit record missing $type! {op.action} {op.repo} {op.path} {cid}')
Expand Down

0 comments on commit 8e670da

Please sign in to comment.