Browse Source

Fix concurrency handling; require aiorpcx 0.13

patch-2
Neil Booth 6 years ago
parent
commit
b943760a19
  1. 4
      electrumx/server/controller.py
  2. 5
      electrumx/server/session.py
  3. 2
      setup.py

4
electrumx/server/controller.py

@ -82,8 +82,8 @@ class Controller(ServerBase):
'''Start the RPC server and wait for the mempool to synchronize. Then
start serving external clients.
'''
if not (0, 12, 1) <= aiorpcx_version < (0, 13):
raise RuntimeError('aiorpcX version 0.12.x, x >= 1, is required')
if not (0, 13, 0) <= aiorpcx_version < (0, 14):
raise RuntimeError('aiorpcX version 0.13.x is required')
env = self.env
min_str, max_str = env.coin.SESSIONCLS.protocol_min_max_strings()

5
electrumx/server/session.py

@ -22,7 +22,8 @@ from ipaddress import ip_address
import attr
from aiorpcx import (
RPCSession, JSONRPCAutoDetect, JSONRPCConnection,
TaskGroup, handler_invocation, RPCError, Request, sleep, Event, FinalRPCError
TaskGroup, handler_invocation, RPCError, Request, sleep, Event,
ExcessiveSessionCostError, FinalRPCError
)
import electrumx
@ -262,7 +263,7 @@ class SessionManager(object):
session.cost_decay_per_sec = hard_limit / (10000 + 5 * session.sub_count())
try:
session.recalc_concurrency()
except FinalRPCError:
except ExcessiveSessionCostError:
await group.spawn(session.close())
def _get_info(self):

2
setup.py

@ -14,7 +14,7 @@ setuptools.setup(
# "xevan_hash" package is required to sync Xuez network.
# "groestlcoin_hash" package is required to sync Groestlcoin network.
# "pycryptodomex" package is required to sync SmartCash network.
install_requires=['aiorpcX>=0.12.1,<0.13', 'attrs',
install_requires=['aiorpcX>=0.13.0,<0.14', 'attrs',
'plyvel', 'pylru', 'aiohttp >= 2'],
packages=setuptools.find_packages(include=('electrumx*',)),
description='ElectrumX Server',

Loading…
Cancel
Save