Skip to content
Snippets Groups Projects
Commit 8f7c9d4a authored by inso's avatar inso
Browse files

Fasten transaction broadcast with asyncio.gather

parent 4cfa07be
No related branches found
No related tags found
No related merge requests found
......@@ -307,9 +307,14 @@ class BmaAccess(QObject):
logging.debug("Trying to connect to : " + node.pubkey)
conn_handler = node.endpoint.conn_handler()
req = request(conn_handler, **req_args)
try:
reply = await req.post(**post_args)
reply = asyncio.ensure_future(req.post(**post_args))
replies.append(reply)
self._invalidate_cache(request)
else:
raise NoPeerAvailable("", len(nodes))
try:
result = await asyncio.gather(*replies)
except ValueError as e:
if '404' in str(e) or '400' in str(e):
raise
......@@ -317,7 +322,4 @@ class BmaAccess(QObject):
pass
except asyncio.TimeoutError:
pass
self._invalidate_cache(request)
else:
raise NoPeerAvailable("", len(nodes))
return tuple(replies)
return tuple(result)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment