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

Default httpx timeout too short #304

Closed
alyssadai opened this issue Apr 12, 2024 · 1 comment · Fixed by #305
Closed

Default httpx timeout too short #304

alyssadai opened this issue Apr 12, 2024 · 1 comment · Fixed by #305
Assignees
Labels
bug:performance Performance defects or response time degradation. importance:urgent We will address this as soon as possible. released This issue/pull request has been released. type:bug Defects in shipped code and fixes for those defects

Comments

@alyssadai
Copy link
Contributor

Our current default timeout limit of 30s is now too short of a window for the n-API to receive the response data from graph, now that we have upgraded to a session-level graph data model (meaning the # triples has greatly increased).

Until we do some internal optimization, we should disable this timeout to avoid n-APIs always timing out for large graph stores.

api/app/api/crud.py

Lines 22 to 50 in 1f89c22

def post_query_to_graph(query: str, timeout: float = 30.0) -> dict:
"""
Makes a post request to the graph API to perform a query, using parameters from the environment.
# TODO: Revisit default timeout value when query performance is improved
Parameters
----------
query : str
The full SPARQL query string.
timeout : float, optional
The maximum duration for the request, by default 5.0 seconds.
Returns
-------
dict
The response from the graph API, encoded as json.
"""
try:
response = httpx.post(
url=util.QUERY_URL,
content=query,
headers=util.QUERY_HEADER,
auth=httpx.BasicAuth(
os.environ.get(util.GRAPH_USERNAME.name),
os.environ.get(util.GRAPH_PASSWORD.name),
),
timeout=timeout,
)

@alyssadai alyssadai added bug:performance Performance defects or response time degradation. type:bug Defects in shipped code and fixes for those defects importance:urgent We will address this as soon as possible. flag:schedule Flag issue that should go on the roadmap or backlog. labels Apr 12, 2024
@alyssadai alyssadai changed the title Disable default httpx timeout Default httpx timeout too short Apr 12, 2024
@alyssadai alyssadai removed the flag:schedule Flag issue that should go on the roadmap or backlog. label Apr 12, 2024
@alyssadai alyssadai self-assigned this Apr 12, 2024
@surchs
Copy link
Contributor

surchs commented Apr 16, 2024

🚀 Issue was released in v0.2.1 🚀

@surchs surchs added the released This issue/pull request has been released. label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:performance Performance defects or response time degradation. importance:urgent We will address this as soon as possible. released This issue/pull request has been released. type:bug Defects in shipped code and fixes for those defects
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants