简体   繁体   English

Neo4j,graphaware:捕获异常后,将不再执行其他查询。

[英]Neo4j, graphaware: After catching an exception, another query will not execute.

I am connecting to neo4j the normal way and i can run queries no problem. 我以正常方式连接到neo4j,我可以运行查询没有问题。
During testing, i wrote a query that should fail (due to uniqueness constraint), the query does fail as expected and i catch the exception. 在测试期间,我编写了一个应该失败的查询(由于唯一性约束),该查询确实按预期失败,并且我捕获了异常。
The problem is when i try to execute the next query in the queue, it just hangs (longer than timeout). 问题是当我尝试执行队列中的下一个查询时,它只是挂起(比超时时间长)。
I don't suppose that is normal behavior. 我不认为这是正常行为。

 try{
     $result = $neo->run ($query);
 }
 catch (Exception $e) {
          // handle it
 }

 // all good so far
 // now we attempt:

try{
    $result = $neo->run ($next_query);
 }
 catch (Exception $e) {
          // handle it
 }
// hangs longer than timeout

if i remove the failed query from the queue, everything completes 如果我从队列中删除失败的查询,则一切完成

So it seems that the exception thrown by the php-client breaks the connection to neo4j. 因此,似乎php-client抛出的异常中断了与neo4j的连接。
If i modify the code to the following, it all works fine. 如果我将代码修改为以下内容,则一切正常。

try{
     $result = $neo->run ($query);
 }
 catch (Exception $e) {
          // handle it
      connect_to_neo()
 }

 // all good so far

try{
    $result = $neo->run ($next_query);
 }
 catch (Exception $e) {
          // handle it
 }
 // all good, $next_query gets executed

I do not think that an exception that breaks the connection is desired behavior. 我认为中断连接的异常不是所需的行为。 Will raise the issue on github. 将在github上提出问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM