From f26394fd3b40d1168611797f77306aac863cdc34 Mon Sep 17 00:00:00 2001
From: Victor Shyba <victor.shyba@gmail.com>
Date: Mon, 8 Mar 2021 01:29:08 -0300
Subject: [PATCH] report deletions on docs that doesnt exist, but dont raise

---
 lbry/wallet/server/db/elastic_search.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lbry/wallet/server/db/elastic_search.py b/lbry/wallet/server/db/elastic_search.py
index 725aae7a5..8c6812e60 100644
--- a/lbry/wallet/server/db/elastic_search.py
+++ b/lbry/wallet/server/db/elastic_search.py
@@ -101,7 +101,8 @@ class SearchIndex:
     async def claim_consumer(self, claim_producer):
         await self.client.indices.refresh(self.index)
         touched = set()
-        async for ok, item in async_streaming_bulk(self.client, self._consume_claim_producer(claim_producer)):
+        async for ok, item in async_streaming_bulk(self.client, self._consume_claim_producer(claim_producer),
+                                                   raise_on_error=False):
             if not ok:
                 self.logger.warning("indexing failed for an item: %s", item)
             else:
@@ -283,8 +284,10 @@ class SearchIndex:
                 claim_id = url.stream.claim_id
             else:
                 claim_id = await self.full_id_from_short_id(query['name'], query['claim_id'], channel_id)
-            stream = await self.get_many(claim_id)
-            return stream[0] if len(stream) else None
+            if claim_id:
+                stream = await self.get_many(claim_id)
+                return stream[0] if len(stream) else None
+            return None
 
         if channel_id is not None:
             if set(query) == {'name'}: