leaflet-blurred-location icon indicating copy to clipboard operation
leaflet-blurred-location copied to clipboard

Optimize to address exceeded rate limit while geocoding

Open jywarren opened this issue 6 years ago • 3 comments

On PublicLab.org it seems to be making thousands of calls, very quickly; running through the API rate limit. Try it on https://publiclab.org/micro for example!

jywarren avatar Dec 03 '18 02:12 jywarren

These 2 listeners are calling the Google Geocoding API :

1.) Called when we select from the autocomplete list : https://github.com/publiclab/leaflet-blurred-location/blob/7ca8da726a6818fa0926a5612a72af9d96e2e1d5/src/core/Geocoding.js#L65

2.) Called when Enter key is pressed : https://github.com/publiclab/leaflet-blurred-location/blob/7ca8da726a6818fa0926a5612a72af9d96e2e1d5/src/core/Geocoding.js#L72

I have tested both listeners , they are called at the same time and only when ENTER (13) key is pressed ! So for one search - 2 calls are going to API . We can do this optimization to call only 1 time , will do this as soon as we solve #161 .

Thanks !

sagarpreet-chadha avatar Dec 03 '18 09:12 sagarpreet-chadha

Resolving in #214 with a paid-for API key limited to PL domains!

jywarren avatar Dec 10 '19 22:12 jywarren

However, if we want to re-open for optimization, we can rename this and keep it open! Let's do that!

jywarren avatar Dec 10 '19 22:12 jywarren