jgarzik / jgarzik/python-bitcoinrpc

RPC connection note closed

Abierto
#76 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
663
Forks
300
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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)))
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
api, backend
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.