flush databases during sync

This commit is contained in:
Jack Robison 2020-06-12 00:51:02 -04:00
parent 375187aa70
commit caf616234b
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -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."""