Question

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')
Was it helpful?

Solution

Give this a try:

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

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top