Skip to content

Catch timeout errors from API #84

@ehenneken

Description

@ehenneken

This part of the code catches exceptions that have not been caught

        try:
            return solve_for_fields(hypothesis)
        except Undecidable as ex:
            possible_solutions.extend(ex.considered_solutions)
            reason = ex.reason
        except (NoSolution, OverflowOrNone) as ex:
            current_app.logger.debug("(%s)"%ex.__class__.__name__)
        except (Solr, KeyboardInterrupt):
            raise
        except Exception as ex:
            current_app.logger.error("Unhandled exception of type {0} occurred with arguments:{1!r}, thus killing a single hypothesis.".format(type(ex).__name__, ex.args))
            current_app.logger.error(traceback.format_exc())

So, one exception it does not catch is a ReadTimeoutError (which happens when a request takes too long and the API closes the connection).

An addition except ReadTimeoutError rule should be added, so that only unexpected exceptions will get caught by the final step.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions