From b0de078732efecf8bd9936abfbf03d7baee4bd24 Mon Sep 17 00:00:00 2001 From: Ryan Barrett Date: Fri, 6 Sep 2024 12:23:15 -0700 Subject: [PATCH] atproto_firehose: delay parsing payload until we know it's a commit again, this time for libipld for #1295 --- atproto_firehose.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/atproto_firehose.py b/atproto_firehose.py index 6f301331..e8eaece1 100644 --- a/atproto_firehose.py +++ b/atproto_firehose.py @@ -218,21 +218,23 @@ def handle(limit=None): return while frame := events.get(): - header, payload = libipld.decode_dag_cbor_multi(frame) - buf = BytesIO(frame) + header = libipld.decode_dag_cbor(frame) + # buf = BytesIO(frame) # parse header if header.get('op') == -1: + _, payload = libipld.decode_dag_cbor_multi(frame) logger.warning(f'Got error from relay! {payload}') continue t = header.get('t') if t != '#commit': - if t not in ('#account', '#identity', '#handle'): + if t not in ('#account', '#identity', '#handle', '#tombstone'): logger.info(f'Got {t} from relay') continue # parse payload + _, payload = libipld.decode_dag_cbor_multi(frame) repo = payload.get('repo') if not repo: logger.warning(f'Payload missing repo! {payload}')