Skip to content

Commit

Permalink
atproto_firehose: add instructions for running locally
Browse files Browse the repository at this point in the history
ie what to comment out to prevent creating receive tasks or updating cursor in the datastore
  • Loading branch information
snarfed committed Aug 30, 2024
1 parent 19430a2 commit 1ecad1f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion atproto_firehose.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ def subscribe():
# it's been long enough, update our stored cursor
logger.info(f'updating stored cursor to {cursor.cursor}')
cursor.put()
# when running locally, comment out put above and uncomment this
# cursor.updated = util.now().replace(tzinfo=None)

# ops = ' '.join(f'{op.get("action")} {op.get("path")}'
# for op in payload.get('ops', []))
Expand Down Expand Up @@ -320,11 +322,12 @@ def _handle(op):
return

try:
# logger.info(f'enqueuing receive task for {at_uri}')
obj = Object.get_or_create(id=obj_id, authed_as=op.repo, status='new',
users=[ATProto(id=op.repo).key],
source_protocol=ATProto.LABEL, **record_kwarg)
create_task(queue='receive', obj=obj.key.urlsafe(), authed_as=op.repo)
# when running locally, comment out above and uncomment this
# logger.info(f'enqueuing receive task for {at_uri}')
except BaseException:
report_exception()

Expand Down

0 comments on commit 1ecad1f

Please sign in to comment.