Browse Source

Merge pull request #91 from shsmith/master

move sleep outside semaphore (issue 88)
master 0.9.19
Neil 8 years ago
committed by GitHub
parent
commit
2d9219981d
  1. 5
      RELEASE-NOTES
  2. 9
      server/block_processor.py
  3. 2
      server/version.py

5
RELEASE-NOTES

@ -1,3 +1,8 @@
version 0.9.19
--------------
- move sleep outside semaphore (issue 88)
version 0.9.18 version 0.9.18
-------------- --------------

9
server/block_processor.py

@ -89,7 +89,9 @@ class Prefetcher(LoggedClass):
while True: while True:
try: try:
with await self.semaphore: with await self.semaphore:
await self._prefetch_blocks(caught_up_event.is_set()) fetched = await self._prefetch_blocks(caught_up_event.is_set())
if not fetched:
await asyncio.sleep(5)
await self.refill_event.wait() await self.refill_event.wait()
except DaemonError as e: except DaemonError as e:
self.logger.info('ignoring daemon error: {}'.format(e)) self.logger.info('ignoring daemon error: {}'.format(e))
@ -113,8 +115,7 @@ class Prefetcher(LoggedClass):
if not count: if not count:
self.cache.put_nowait(([], 0)) self.cache.put_nowait(([], 0))
self.caught_up = True self.caught_up = True
await asyncio.sleep(5) return False
return
first = self.fetched_height + 1 first = self.fetched_height + 1
hex_hashes = await self.daemon.block_hex_hashes(first, count) hex_hashes = await self.daemon.block_hex_hashes(first, count)
@ -140,7 +141,7 @@ class Prefetcher(LoggedClass):
self.fetched_height += count self.fetched_height += count
self.refill_event.clear() self.refill_event.clear()
return True
class ChainError(Exception): class ChainError(Exception):
'''Raised on error processing blocks.''' '''Raised on error processing blocks.'''

2
server/version.py

@ -1 +1 @@
VERSION = "ElectrumX 0.9.18" VERSION = "ElectrumX 0.9.19"

Loading…
Cancel
Save