You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current implementation causes port exhaustion. This can be solved implementing urllib3 PoolManager. Implementing this prevents opening a new port for every http request. This means less processor overhead and 30% time winst.
#Add
from urllib3 import PoolManager
class SubstrateInterface:
def __init__
#Add
self.http = PoolManager()
def rpc_request(self, method, params):
else:
#previous: response = requests.request("POST", self.url, data=json.dumps(payload), headers=self.default_headers)
response = self.http.request("POST", self.url, body=json.dumps(payload), headers=self.default_headers)
#previous: if response.status_code != 200:
if response.status != 200:
#previous: raise SubstrateRequestException("RPC request failed with HTTP status code {}".format(response.status_code ))
raise SubstrateRequestException("RPC request failed with HTTP status code {}".format(response.status))
#previous: json_body = response.json()
json_body = json.loads(response.data.decode('utf-8'))`
The text was updated successfully, but these errors were encountered:
Current implementation causes port exhaustion. This can be solved implementing urllib3 PoolManager. Implementing this prevents opening a new port for every http request. This means less processor overhead and 30% time winst.
The text was updated successfully, but these errors were encountered: