forked from LBRYCommunity/lbry-sdk
flush databases during sync
This commit is contained in:
parent
375187aa70
commit
caf616234b
1 changed files with 3 additions and 5 deletions
|
@ -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."""
|
||||
|
|
Loading…
Reference in a new issue