wait while calculating shortest path