From 73696788adbea91b659eb59d2b75a3c49a81e68f Mon Sep 17 00:00:00 2001 From: turntayble81 Date: Tue, 29 May 2018 11:03:06 -0400 Subject: [PATCH] Updated addressFilter lib to process addresses in series. --- lib/addressFilter.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/addressFilter.js b/lib/addressFilter.js index d989351..fc37223 100644 --- a/lib/addressFilter.js +++ b/lib/addressFilter.js @@ -32,7 +32,7 @@ function run({coordinates=[], addresses=[]}=args={}, cb) { //Iterate over array of addresses, asyncronously calling Google's API //for each address to determine it's lat/lng coordinates - async.each(addresses, (address, eachNext) => { + async.eachSeries(addresses, (address, eachNext) => { googleMapsClient.geocode({address}, (err, response) => { @@ -54,12 +54,6 @@ function run({coordinates=[], addresses=[]}=args={}, cb) { eachNext(); }); }, (err) => { - - //Because we're asyncronously calling Google's API, return order can't be - //guaranteed. As a result, let's sort the array just so it always comes out - //the same way - withinRegionArr.sort(); - return cb(err, withinRegionArr); }); }