diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7c83946a2..37f3eb643 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,8 @@ +version 0.9.19 +-------------- + +- move sleep outside semaphore (issue 88) + version 0.9.18 -------------- diff --git a/server/block_processor.py b/server/block_processor.py index a62badce6..9227a9600 100644 --- a/server/block_processor.py +++ b/server/block_processor.py @@ -89,7 +89,9 @@ async def main_loop(self, caught_up_event): while True: try: 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() except DaemonError as e: self.logger.info('ignoring daemon error: {}'.format(e)) @@ -113,8 +115,7 @@ async def _prefetch_blocks(self, mempool): if not count: self.cache.put_nowait(([], 0)) self.caught_up = True - await asyncio.sleep(5) - return + return False first = self.fetched_height + 1 hex_hashes = await self.daemon.block_hex_hashes(first, count) @@ -140,7 +141,7 @@ async def _prefetch_blocks(self, mempool): self.fetched_height += count self.refill_event.clear() - + return True class ChainError(Exception): '''Raised on error processing blocks.''' diff --git a/server/version.py b/server/version.py index a0336c028..be314a970 100644 --- a/server/version.py +++ b/server/version.py @@ -1 +1 @@ -VERSION = "ElectrumX 0.9.18" +VERSION = "ElectrumX 0.9.19"