From caf616234bb7986d2d890e6a25935f75fb91eb3f Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Fri, 12 Jun 2020 00:51:02 -0400 Subject: [PATCH] flush databases during sync --- lbry/wallet/server/block_processor.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lbry/wallet/server/block_processor.py b/lbry/wallet/server/block_processor.py index e2ecb69ce..eceb62e08 100644 --- a/lbry/wallet/server/block_processor.py +++ b/lbry/wallet/server/block_processor.py @@ -351,11 +351,9 @@ class BlockProcessor: # performed on the DB. if self._caught_up_event.is_set(): await self.flush(True) - elif time.time() > self.next_cache_check: - flush_arg = self.check_cache_size() - if flush_arg is not None: - await self.flush(flush_arg) - self.next_cache_check = time.time() + 30 + elif time.perf_counter() > self.next_cache_check: + await self.flush(True) + self.next_cache_check = time.perf_counter() + 30 def check_cache_size(self): """Flush a cache if it gets too big."""