Pregunta

I'm using Python 2.7.1, IPython 0.13.1 and py2neo 1.5 in order to modify Neo4j graph database content. After some time without interaction with Neo4j, the connection gets reset by Neo4j. This is slightly inconvenient.

Question: How can I either increase the time of inactivity or have something like connection keep alive so that the connection reset doesn't occur or occurs less often?

/Library/Python/2.7/site-packages/py2neo/rest.pyc in _send(self, request)
    428             return self._client().send(request)
    429         except socket.error as err:
--> 430             raise SocketError(err)
    431 
    432     def _metadata(self, key, default=None):

SocketError: error(54, 'Connection reset by peer')
¿Fue útil?

Solución

Give this a try:

from py2neo.packages.httpstream import http
http.socket_timeout = 9999

Otros consejos

Limiting the transaction batch size to ~20k rows solved the problem for me. Hope this helps!

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top