Timeouts before endpoint returns response

Issue #58 resolved
Steven Maude created an issue

No description provided.

Comments (9)

  1. ian_hopkinson

    Can we give an informative error message on timeout?

    i.e. "Your query timed out, refresh this page in a few minutes and you might get lucky"

  2. Steven Maude reporter

    As a quick fix, you could possibly do something horrible like checking whether it's cached, if yes, return response, otherwise return "Probably still running query; try refreshing in a few minutes".

    See https://github.com/scraperwiki/data-services-helpers/blob/master/dshelpers.py#L171-L181

    The caveat is: that code did seem to be having issues previously when used here, as it wasn't finding requests that were actually in the cache.

    (A better way would be some Ajax-y thing that loads a please wait page and gets the query response when it arrives, though probably no time for that right now.)

  3. Dragon Dave McKee

    Ajax doesn't help the JSON version.

    Is this timeout not under our control?

    I think the informative error message is probably the way forward, bonus points for having a nice HTTP error code (408?) (The HTML one could auto-refresh every so often)

    Ideally we'd also want to make sure that a second request for the same material doesn't launch a second query if the first one is running, but that's more tricky.

  4. Steven Maude reporter

    "Ajax doesn't help the JSON version."

    True! (Though we could just disable JSON for the query that this seems to happen for)

    The timeout is under our control, though it's not ideal to up it indefinitely as several people running such queries could potentially block web access entirely.

  5. ian_hopkinson

    I've disabled the Framenet queries, which cause the problem, and implemented a query by event label which seems to more efficient.

    I consider the JSON response as primary, since we are offering an API rather than a search tool, so wouldn't like to disable it.

  6. Log in to comment