geocode-sqlite icon indicating copy to clipboard operation
geocode-sqlite copied to clipboard

Async support

Open eyeseast opened this issue 5 years ago • 2 comments

Geopy has a set of tools to help with async here: https://geopy.readthedocs.io/en/latest/#async-mode

Should definitely use those, especially when thinking about Datasette integration.

eyeseast avatar Sep 21 '20 17:09 eyeseast

What does this look like in code?

Geopy strongly recommends using a context manager for async calls. And geocode_row right now requires a geocoder function (because of rate limiting). There's a lot to manage here.

Rate limiting example here: https://geopy.readthedocs.io/en/latest/#geopy.extra.rate_limiter.AsyncRateLimiter

It's very possible I'll need to collect all the arguments for everything up front, and then sort everything out. That's messy.

eyeseast avatar Sep 22 '20 15:09 eyeseast

Thinking about this more, especially after spending more time with faster services like OpenCage, Google and Mapbox, I should probably decide whether this is a sync or async library overall. Being in both places is probably too much to manage.

eyeseast avatar Nov 15 '22 15:11 eyeseast