From 830ee294efca147f95d34ae086483d810d904c4f Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 17 May 2022 19:20:31 -0400 Subject: [PATCH] batched catch up for the address status index --- scribe/blockchain/service.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scribe/blockchain/service.py b/scribe/blockchain/service.py index 952899f..078f06b 100644 --- a/scribe/blockchain/service.py +++ b/scribe/blockchain/service.py @@ -1693,6 +1693,8 @@ class BlockchainProcessorService(BlockchainService): self._ready_to_stop.set() async def _need_catch_up(self): + self.log.info("database has fallen behind blockchain daemon, catching up") + self.db.catching_up = True def flush(): @@ -1706,8 +1708,8 @@ class BlockchainProcessorService(BlockchainService): async def _finished_initial_catch_up(self): self.log.info(f'caught up to height {self.height}') - # if self.env.index_address_status and self.db.last_indexed_address_status_height != self.db.db_height: - # await self.db.rebuild_hashX_status_index(self.db.last_indexed_address_status_height) + if self.env.index_address_status and self.db.last_indexed_address_status_height < self.db.db_height: + await self.db.rebuild_hashX_status_index(self.db.last_indexed_address_status_height) # Flush everything but with catching_up->False state. self.db.catching_up = False