Skip to content

Commit

Permalink
only perform net consistency check once
Browse files Browse the repository at this point in the history
  • Loading branch information
paulheinr committed Aug 9, 2024
1 parent a455df3 commit cda5767
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class NetworkRoutingProvider implements Provider<RoutingModule>{
private static final Logger log = LogManager.getLogger( NetworkRoutingProvider.class ) ;

private final String routingMode;
private boolean alreadyCheckedConsistency = false;

@Inject Map<String, TravelTime> travelTimes;
@Inject Map<String, TravelDisutilityFactory> travelDisutilityFactories;
Expand Down Expand Up @@ -142,6 +143,12 @@ private void checkNetwork(Network filteredNetwork) {
return;
}

if(alreadyCheckedConsistency){
return;
}

log.info("Checking network for mode '{}' for consistency...", mode);

int nLinks = filteredNetwork.getLinks().size();
int nNodes = filteredNetwork.getNodes().size();
new NetworkCleaner().run(filteredNetwork);
Expand All @@ -153,5 +160,7 @@ private void checkNetwork(Network filteredNetwork) {
"\n If this network topology is intended, set the routing config parameter 'networkRouteConsistencyCheck' to 'disable'.");
throw new RuntimeException(errorMessage);
}

alreadyCheckedConsistency = true;
}
}

0 comments on commit cda5767

Please sign in to comment.