I'm developing a routing website using network based on safety. The end result is for the user to enter two locations and have the shortest route, and another route, based on a variety of factors to be displayed.
The way I currently have it is two separate routeTask functions running one after another using the same NAService. 99% of the time it works perfectly, but whenever I update the service, or after a long time of it not running one of these functions hang. The first one runs quickly and the second one tasks up to 30seconds to process (see image of console log).
straight away after it has run for the first time, with new locations, it is very quick (as per second image)
I've looked into ways of initializing routeTask, and the only way i've come up with is to run it on page load - which I am reluctant to do.
Does anyone know of a solution for this problem? It is a pain as both results displaying as quickly as possible are crucial for this website.