Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle database timeouts #16

Merged
merged 1 commit into from
Sep 25, 2015
Merged

handle database timeouts #16

merged 1 commit into from
Sep 25, 2015

Conversation

missinglink
Copy link
Member

hey @orangejulius I've been noticing a bunch of my test cases failing with the message "no results returned" against the v1 code.

the error is caused when the elasticsearch client times out a query with the message "Request Timeout after 3000ms", we used to return statusCode:500 for this error but now we return statusCode:200 and features: [] with the message parroted back to the user in the geojson as res.geocoding.errors[0]

eg.

  "statusCode": 200,
  "body": {
    "geocoding": {
...
      "errors": [
        "Request Timeout after 3000ms"
      ],
...
    "type": "FeatureCollection",
    "features": []
  },

this PR is not really that nice (code wise) so that's totally open for a rewrite but at least it shows a place in the code where we may be able to handle this case and maybe retry those queries? I guess we wouldn't want to retry them indefinitely; because DOS.

thoughts?

@orangejulius
Copy link
Member

I'm fine with this code. I'd like us to also make that case return 500 again, but there's nothing wrong with cramming this in here :) 👍

@orangejulius orangejulius merged commit cadff62 into master Sep 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants