You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our team noticed that using this library causes an excessive amount of calls to the Google Maps Distance Matrix API to be charged to our token and billing account.
In the current implementation, once the ETA from the server dips below 10 minutes, it starts calculating the ETA by using the Google Maps Distance Matrix API. In my testing, it is making 2 calls to Distance Matrix API every time the driver location updates. The issue stems from the MAX_LOCATION_POINTS_FOR_UPDATE variable being set to 50, which seems too low and causes multiple calls to the Distance Matrix API during a normal smooth map update.
It doesn't seem like the ETA needs to be recalculated with every driver location update. The previous eta calculation could be persisted for a certain amount of time, for example 2-3 minutes, and the eta callback could be invoked with the value of (etaTimeAtLastCalculation - timeElapsedSinceLastEtaCalculation).
I will put together a PR with this optimization. Would appreciate any feedback!
The text was updated successfully, but these errors were encountered:
wtm17
changed the title
Excessive calls to Google Distance Matrix API
Excessive calls to Google Maps Distance Matrix API
Jul 24, 2019
Our team noticed that using this library causes an excessive amount of calls to the Google Maps Distance Matrix API to be charged to our token and billing account.
In the current implementation, once the ETA from the server dips below 10 minutes, it starts calculating the ETA by using the Google Maps Distance Matrix API. In my testing, it is making 2 calls to Distance Matrix API every time the driver location updates. The issue stems from the MAX_LOCATION_POINTS_FOR_UPDATE variable being set to 50, which seems too low and causes multiple calls to the Distance Matrix API during a normal smooth map update.
It doesn't seem like the ETA needs to be recalculated with every driver location update. The previous eta calculation could be persisted for a certain amount of time, for example 2-3 minutes, and the eta callback could be invoked with the value of (etaTimeAtLastCalculation - timeElapsedSinceLastEtaCalculation).
I will put together a PR with this optimization. Would appreciate any feedback!
The text was updated successfully, but these errors were encountered: