diff --git a/atproto_firehose.py b/atproto_firehose.py index d2209261..17d5473f 100644 --- a/atproto_firehose.py +++ b/atproto_firehose.py @@ -78,7 +78,8 @@ def _load_dids(): new_atproto = [key.id() for key in atproto_query.iter(keys_only=True)] atproto_dids.update(new_atproto) - bridged_query = AtpRepo.query(AtpRepo.created > bridged_loaded_at) + bridged_query = AtpRepo.query(AtpRepo.status == None, + AtpRepo.created > bridged_loaded_at) bridged_loaded_at = AtpRepo.query().order(-AtpRepo.created).get().created new_bridged = [key.id() for key in bridged_query.iter(keys_only=True)] bridged_dids.update(new_bridged) diff --git a/index.yaml b/index.yaml index ff1efba8..c9cb41e5 100644 --- a/index.yaml +++ b/index.yaml @@ -84,3 +84,8 @@ indexes: properties: - name: updated - name: enabled_protocols + +- kind: AtpRepo + properties: + - name: status + - name: created diff --git a/tests/test_atproto_firehose.py b/tests/test_atproto_firehose.py index d842e1c8..831b0ad1 100644 --- a/tests/test_atproto_firehose.py +++ b/tests/test_atproto_firehose.py @@ -429,6 +429,17 @@ class ATProtoFirehoseSubscribeTest(TestCase): }) self.assertIn('did:plc:eve', atproto_firehose.bridged_dids) + def test_load_dids_tombstoned_atprepo(self): + FakeWebsocketClient.to_receive = [({'op': 1, 't': '#info'}, {})] + + AtpRepo(id='did:plc:eve', head='', signing_key_pem=b'', + status=arroba.util.TOMBSTONED).put() + + self.subscribe() + + # tombstoned AtpRepo shouldn't be loaded into bridged_dids + self.assertNotIn('did:plc:eve', atproto_firehose.bridged_dids) + @patch('oauth_dropins.webutil.appengine_config.tasks_client.create_task') class ATProtoFirehoseHandleTest(TestCase):