Browse Source

Remove deprecated "with await" syntax

patch-2
Neil Booth 7 years ago
parent
commit
22c75a6216
  1. 4
      server/block_processor.py
  2. 2
      server/db.py

4
server/block_processor.py

@ -64,7 +64,7 @@ class Prefetcher(LoggedClass):
Used in blockchain reorganisations. This coroutine can be
called asynchronously to the _prefetch coroutine so we must
synchronize with a semaphore.'''
with await self.semaphore:
async with self.semaphore:
self.fetched_height = self.bp.height
self.refill_event.set()
@ -85,7 +85,7 @@ class Prefetcher(LoggedClass):
'''
daemon = self.bp.daemon
daemon_height = await daemon.height(self.bp.caught_up_event.is_set())
with await self.semaphore:
async with self.semaphore:
while self.cache_size < self.min_cache_size:
# Try and catch up all blocks but limit to room in cache.
# Constrain fetch count to between 0 and 500 regardless;

2
server/db.py

@ -662,7 +662,7 @@ class DB(util.LoggedClass):
while self.comp_cursor != -1:
if self.semaphore.locked:
self.log_info('compact_history: waiting on semaphore...')
with await self.semaphore:
async with self.semaphore:
await loop.run_in_executor(None, self._compact_history, limit)
def cancel_history_compaction(self):

Loading…
Cancel
Save