jgarzik / jgarzik/python-bitcoinrpc

RPC connection note closed

Offen
#76 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
663
Forks
300
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hi, I have many threads in my wallet after using your code.
Is it possible to call `connection.close` somewhere?
Or should I use the more pythonic `with`?

My code is as follows:

```
class BaseRpcClient(BaseApiClient):

def __init__(self):
super(BaseRpcClient, self).__init__()
self.api_cache = {}
self.rpc_endpoint = None

def get_api(self, node):
self.rpc_endpoint = RpcMapper.get_rpc_addr(node)
if self.rpc_endpoint not in self.api_cache:
self.api_cache[self.rpc_endpoint] = \
AuthServiceProxy(self.rpc_endpoint)
self.api = self.api_cache[self.rpc_endpoint]
return self.api

def call_api(self, node, endpoint, *args):
api = self.get_api(node)
try:
fn = getattr(api, endpoint)
return fn(*args)
except JSONRPCException as e:
self.logger.error('JSON RPC ERROR HOST {} ERROR {}'
.format(self.rpc_endpoint, str(e)))
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start by tracing BaseRpcClient.get_api and call_api, then inspect how AuthServiceProxy creates and manages RPC connections. Reproduce the reported thread growth and determine the intended connection lifecycle; done should include a verified way to release connections, with coverage for repeated API use if tests are available.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
api, backend
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.