Browse Source

Merge branch 'release-0.8.2'

master 0.8.2
Neil Booth 8 years ago
parent
commit
32076adf55
  1. 14
      RELEASE-NOTES
  2. 10
      lib/jsonrpc.py
  3. 12
      server/block_processor.py
  4. 2
      server/version.py

14
RELEASE-NOTES

@ -1,3 +1,17 @@
version 0.8.2
-------------
- process new blocks in the asyncio executor; essentially a python thread.
This should eliminate latency during block processing that caused sessions
to be dropped.
- bandwith limit is restored incrementally to a session over the hour
rather than in a lump when one hour has passed. Also, only the
limit is refunded each hour; previously the entire usage would be
refunded. So if the session uses 30MB bandwidth and your limit is
10MB, it will take 3 hrs before the session is considered to have
used none of its allotted bandwidth; previously it would happen after 1
hour.
version 0.8.1
-------------

10
lib/jsonrpc.py

@ -129,10 +129,12 @@ class JSONRPC(asyncio.Protocol, LoggedClass):
def using_bandwidth(self, amount):
now = time.time()
if now >= self.bandwidth_start + self.bandwidth_interval:
self.bandwidth_start = now
self.bandwidth_used = 0
self.bandwidth_used += amount
# Reduce the recorded usage in proportion to the elapsed time
elapsed = now - self.bandwidth_start
self.bandwidth_start = now
refund = int(elapsed / self.bandwidth_interval * self.bandwidth_limit)
refund = min(refund, self.bandwidth_used)
self.bandwidth_used += amount - refund
def data_received(self, data):
'''Handle incoming data (synchronously).

12
server/block_processor.py

@ -201,6 +201,7 @@ class BlockProcessor(server.db.DB):
self.first_caught_up()
self.flush(True)
self.logger.info('shut down complete')
def shutdown(self):
'''Call to shut down the block processor.'''
@ -213,11 +214,16 @@ class BlockProcessor(server.db.DB):
if self.height == -1:
blocks[0] = blocks[0][:self.coin.HEADER_LEN] + bytes(1)
touched = set()
try:
def do_it():
for block in blocks:
if self._shutdown:
break
self.advance_block(block, touched)
await asyncio.sleep(0) # Yield
touched = set()
loop = asyncio.get_event_loop()
try:
await loop.run_in_executor(None, do_it)
except ChainReorg:
await self.handle_chain_reorg(touched)

2
server/version.py

@ -1 +1 @@
VERSION = "ElectrumX 0.8.1"
VERSION = "ElectrumX 0.8.2"

Loading…
Cancel
Save