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.
|
# performed on the DB.
|
||||||
if self._caught_up_event.is_set():
|
if self._caught_up_event.is_set():
|
||||||
await self.flush(True)
|
await self.flush(True)
|
||||||
elif time.time() > self.next_cache_check:
|
elif time.perf_counter() > self.next_cache_check:
|
||||||
flush_arg = self.check_cache_size()
|
await self.flush(True)
|
||||||
if flush_arg is not None:
|
self.next_cache_check = time.perf_counter() + 30
|
||||||
await self.flush(flush_arg)
|
|
||||||
self.next_cache_check = time.time() + 30
|
|
||||||
|
|
||||||
def check_cache_size(self):
|
def check_cache_size(self):
|
||||||
"""Flush a cache if it gets too big."""
|
"""Flush a cache if it gets too big."""
|
||||||
|
|
Loading…
Add table
Reference in a new issue