Skip to content

Handle cases where requests to some nodes fail #38

@alyssadai

Description

@alyssadai

This could be due to the:

  • The API not existing in the first place (e.g., https://fakeapi.org/) - this is a problem with the request
  • The API existing but is down or there is some other issue that causes a failure response code

TODO:

  • write a test with two stubbed node-APIs, one of which responds successfully, and the other with an error. assert that the successful response makes it through
  • write a test as above, but the "bad" node-API doesn't react / times out / is unreachable
  • when a request partially succeeds, the API response should return:
    • A custom success status code (https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/207)
    • A response body containing the query results for the nodes that responded successfully, and also the errors from the nodes that failed (e.g., {"errors": {"node_name": ..., "error": ...}, "responses": ..., "nodes_response_status": ...})
  • use above response body template for all federated query responses, changing the status key as needed, including when requests to all nodes fail (use 207 status as well)
  • log to console when >=1 APIs do not respond with success, with the;
    • URL of the API that failed
    • error message from the API/request, as a warning
  • always print (info) to console if all nodes succeeded, or if some failed (e.g., 2/3)
  • do programming stuff to make the tests pass
  • switch to sending requests to node APIs asynchronously using asyncio

Metadata

Metadata

Assignees

Labels

releasedThis issue/pull request has been released.

Type

No type

Projects

Status

Review - Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions