Skip to content

Commit

Permalink
Timeboxed connectedness check in 'cd'
Browse files Browse the repository at this point in the history
  • Loading branch information
tinwelint committed Jul 8, 2011
1 parent ca5cfda commit a35f330
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions shell/src/main/java/org/neo4j/shell/kernel/apps/Cd.java
Expand Up @@ -303,6 +303,7 @@ private boolean isConnected( NodeOrRelationship current, TypedId newId )
if ( current.isNode() )
{
Node currentNode = current.asNode();
long startTime = System.currentTimeMillis();
for ( Relationship rel : currentNode.getRelationships() )
{
if ( newId.isNode() )
Expand All @@ -320,6 +321,11 @@ private boolean isConnected( NodeOrRelationship current, TypedId newId )
return true;
}
}
if ( System.currentTimeMillis()-startTime > 350 )
{
// DOn't spend too long time in here
return true;
}
}
}
else
Expand Down

0 comments on commit a35f330

Please sign in to comment.