Search code examples
pythonneo4jpy2neo

how do I abort a query in py2neo?


I'm developing a web app that is basically a GUI to this Neo4j dataset we have here at my organization. The app is in Python (I'm using Flask+Tornado) and I'm using py2neo to connect to Neo4j. Things work fine, but sometimes a query will take too long to execute and it continues executing even if the user closes the tab or browser (or clicks that button that stops loading the page). So, how can I have the query aborted when the user closes the tab or browser or clicks the stop button?


Solution

  • Long running queries - For that you can set following 2 parameters in neo4j.properties: -

    execution_guard_enabled=true
    # it is milliseconds
    org.neo4j.server.webserver.limit.executiontime=20000
    

    As of now i do not see any option available in Py2neo to directly kill the request, except setting the HTTP timeouts in py2neo libs