Skip to content

Commit

Permalink
atproto_firehose: add missing import
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed Sep 10, 2024
1 parent 72877b7 commit a8b4333
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions atproto_firehose.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
global_cache,
global_cache_policy,
global_cache_timeout_policy,
report_error,
report_exception,
USER_AGENT,
)
Expand Down
9 changes: 9 additions & 0 deletions tests/test_atproto_firehose.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,3 +574,12 @@ def test_missing_type(self, mock_create_task):

self.assertEqual(orig_objs, Object.query().count())
mock_create_task.assert_not_called()

@patch.object(common.error_reporting_client, 'report_exception')
@patch.object(Object, 'get_or_create', side_effect=RuntimeError('oops'))
@patch('common.DEBUG', new=False) # with DEBUG True, report_error just raises
def test_exception_continues(self, mock_create_task, _, __):
commits.put(Op(repo='did:plc:user', action='create', seq=789,
path='app.bsky.feed.post/123', record=REPLY_BSKY))
handle(limit=1)
# just check that we return instead of raising

0 comments on commit a8b4333

Please sign in to comment.