Skip to content

Commit

Permalink
[ECHOT-316] Up library patch version >> 0.1.56: Update processing of …
Browse files Browse the repository at this point in the history
…broadcast_transaction_with_callback in socket client (#8)

[ECHOT-316] Up library patch version >> 0.1.56: Update processing of broadcast_transaction_with_callback in socket client
  • Loading branch information
Eugene Vasilev authored Mar 11, 2020
1 parent d35ea0d commit 5c1bae6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion echopy/echoapi/ws/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ def method(params, *args, **kwargs):
'id': self.get_request_id(),
}
log.debug('{}{}{} {}'.format('\x1b[1;32m', '>>>', '\x1b[0m', query))
r = self.rpcexec(query)
r = self.rpcexec(
query,
name != 'broadcast_transaction_with_callback'
)
message = self.parse_response(r)
return message

Expand Down
6 changes: 4 additions & 2 deletions echopy/echoapi/ws/simplewebsocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def disconnect(self):
""" RPC Calls
"""

def rpcexec(self, payload):
def rpcexec(self, payload, recv=True):
""" Execute a call by sending the payload
"""
if not self.ws:
Expand All @@ -61,13 +61,15 @@ def rpcexec(self, payload):
# We need to lock because we need to wait for websocket
# response but don't want to allow other threads to send
# requests (that might take less time) to disturb
ret = '{"result": null}'
self.__lock.acquire()

# Send over websocket
try:
self.ws.send(json.dumps(payload, ensure_ascii=False).encode("utf8"))
# Receive from websocket
ret = self.ws.recv()
if recv:
ret = self.ws.recv()

finally:
# Release lock
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from setuptools import setup, find_packages

VERSION = "0.1.55"
VERSION = "0.1.56"
packages = find_packages()
packages.remove('test')

Expand Down

0 comments on commit 5c1bae6

Please sign in to comment.