recalc timeout change

This commit is contained in:
Arndt Brenschede 2016-09-30 19:15:18 +02:00
parent 56bdf76806
commit cf5e56054b

View file

@ -790,6 +790,8 @@ public class RoutingEngine extends Thread
throw new IllegalArgumentException( "operation killed by thread-priority-watchdog after " + ( System.currentTimeMillis() - startTime)/1000 + " seconds" ); throw new IllegalArgumentException( "operation killed by thread-priority-watchdog after " + ( System.currentTimeMillis() - startTime)/1000 + " seconds" );
} }
if ( maxRunningTime > 0 ) if ( maxRunningTime > 0 )
{ {
long timeout = ( matchPath == null && fastPartialRecalc ) ? maxRunningTime/3 : maxRunningTime; long timeout = ( matchPath == null && fastPartialRecalc ) ? maxRunningTime/3 : maxRunningTime;
@ -810,11 +812,21 @@ public class RoutingEngine extends Thread
continue; continue;
} }
if ( matchPath != null && fastPartialRecalc && firstMatchCost < 500 && path.cost > 30L*firstMatchCost if ( fastPartialRecalc && matchPath != null && path.cost > 30L*firstMatchCost && !costCuttingTrack.isDirty )
&& !costCuttingTrack.isDirty )
{ {
logInfo( "early exit: firstMatchCost=" + firstMatchCost + " path.cost=" + path.cost ); logInfo( "early exit: firstMatchCost=" + firstMatchCost + " path.cost=" + path.cost );
throw new IllegalArgumentException( "early exit for a close recalc" );
// use an early exit, unless there's a realistc chance to complete within the timeout
if ( path.cost > maxTotalCost/2 && System.currentTimeMillis() - startTime < maxRunningTime/3 )
{
logInfo( "early exit supressed, running for completion, resetting timeout" );
startTime = System.currentTimeMillis();
fastPartialRecalc = false;
}
else
{
throw new IllegalArgumentException( "early exit for a close recalc" );
}
} }
if ( nodeLimit > 0 ) // check node-limit for target island search if ( nodeLimit > 0 ) // check node-limit for target island search