Skip to content

Commit 95d252a

Browse files
committed
isochrone: adapt limit to consumed nodes. visited nodes can be multiple times more
1 parent d428c4b commit 95d252a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

web-bundle/src/main/java/com/graphhopper/resources/IsochroneResource.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ public Response doGet(
158158
sites.add(site2);
159159
}
160160
});
161-
if (shortestPathTree.getVisitedNodes() > graphHopper.getMaxVisitedNodes() / 5) {
162-
throw new IllegalArgumentException("Too many nodes would have to explored (" + shortestPathTree.getVisitedNodes() + "). Let us know if you need this increased.");
163-
}
161+
int consumedNodes = sites.size();
162+
if (consumedNodes > graphHopper.getMaxVisitedNodes() / 3)
163+
throw new IllegalArgumentException("Too many nodes would be included in post processing (" + consumedNodes + "). Let us know if you need this increased.");
164164

165165
// Sites may contain repeated coordinates. Especially for edge-based traversal, that's expected -- we visit
166166
// each node multiple times.
@@ -227,7 +227,8 @@ public Response doGet(
227227
}
228228

229229
sw.stop();
230-
logger.info("took: " + sw.getSeconds() + ", visited nodes:" + shortestPathTree.getVisitedNodes() + ", " + uriInfo.getQueryParameters());
230+
logger.info("took: " + sw.getSeconds() + ", visited nodes:" + shortestPathTree.getVisitedNodes()
231+
+ ", consumed nodes:" + consumedNodes + ", " + uriInfo.getQueryParameters());
231232
return Response.ok(finalJson).header("X-GH-Took", "" + sw.getSeconds() * 1000).
232233
build();
233234
}

0 commit comments

Comments
 (0)