Empty results caused by timeouts!

Currently if the Geocoder API suffers a timeout it seems to return a warning and empty data instead of raising an error. This is not handled by the current Locations code as it expects this scenario to raise an error, not an empty result.

So try increasing the timeout setting if this is happening to you:

You can check this on your instance directly by doing something like the following:

cd /var/discourse
./launcher enter app
rails c

then eg:

[4] pry(main)> Geocoder.search("birk")
Geocoding API not responding fast enough (use Geocoder.configure(:timeout => ...) to set limit).
=> []
 Geocoder.configure(:timeout=> 5)
[6] pry(main)> Geocoder.search("birk")
Geocoding API not responding fast enough (use Geocoder.configure(:timeout => ...) to set limit).
=> []
[7] pry(main)>  Geocoder.configure(:timeout=> 20)
<<SNIP>>
[8] pry(main)> Geocoder.search("birk")
=> [#<Geocoder::Result::Mapquest:0x0000560de03284a0
  @cache_hit=false,
  @data=
   {"street"=>"Birk",
    "adminArea6"=>"",
    "adminArea6Type"=>"Neighborhood",
    "adminArea5"=>"Weißenstadt",
    "adminArea5Type"=>"City",
    "adminArea4"=>"",
    "adminArea4Type"=>"County",
    "adminArea3"=>"Bayern",
    "adminArea3Type"=>"State",
    "adminArea1"=>"DE",
    "adminArea1Type"=>"Country",
    "postalCode"=>"",
    "geocodeQualityCode"=>"B3ACA",
    "geocodeQuality"=>"STREET",
    "dragPoint"=>false,
    "sideOfStreet"=>"N",
    "linkId"=>"DE/STR/p0/2174202",
    "unknownInput"=>"",
    "type"=>"s",
    "latLng"=>{"lat"=>50.07683, "lng"=>11.92214},
    "displayLatLng"=>{"lat"=>50.07683, "lng"=>11.92214},
    "mapUrl"=>
     "http://www.mapquestapi.com/staticmap/v5/map?key=ZbbnwUMdsrfA9rtmPCYPcvZlyUAlgzCG&type=map&size=225,160&locations=50.07683,11.92214|marker-sm-50318A-1&scalebar=true&zoom=15&rand=-1048004822"}>,
 #<Geocoder::Result::Mapquest:0x0000560de0328338
  @cache_hit=false,
  @data=

It currently fails silently. Not sure why the error is not bubbling up to the UI.

1 Like