apply reorg deletion as well

This commit is contained in:
Victor Shyba 2021-02-09 00:36:16 -03:00
parent 1ce328e8a9
commit e21f2362fe
2 changed files with 5 additions and 0 deletions

View file

@ -289,6 +289,7 @@ class BlockProcessor:
if self.sql:
await self.run_in_thread_with_lock(self.db.sql.delete_claims_above_height, self.height)
await self.db.search_index.delete_above_height(self.height)
await self.prefetcher.reset_height(self.height)
self.reorg_count_metric.inc()
except:

View file

@ -150,6 +150,10 @@ class SearchIndex:
await self.client.indices.refresh(self.index)
await self.client.update_by_query(self.index, body=update)
async def delete_above_height(self, height):
await self.client.delete_by_query(self.index, expand_query(height='>'+str(height)))
await self.client.indices.refresh(self.index)
async def session_query(self, query_name, kwargs):
offset, total = kwargs.get('offset', 0) if isinstance(kwargs, dict) else 0, 0
total_referenced = []