cleaned rate limiting in osm

main
Inga 🏳‍🌈 1 year ago
parent 50d84576fc
commit b8f9ee0e76
  1. 7
      src/clients/geocoding/osm.ts

@ -29,8 +29,9 @@ export const createOsmClient = (): Geocoder => {
});
return {
geocode: async (query) => {
const result = await queue.add(() => geocoder.geocode(query));
geocode: async (query) =>
queue.add(async () => {
const result = await geocoder.geocode(query);
if (!result.length) {
throw new Error('No results found');
@ -58,6 +59,6 @@ export const createOsmClient = (): Geocoder => {
latitude: meanLatitude,
longitude: meanLongitude,
};
},
}),
};
};

Loading…
Cancel
Save