Skip to content

Commit

Permalink
Run black
Browse files Browse the repository at this point in the history
  • Loading branch information
maximusunc committed Aug 18, 2023
1 parent 37de5ab commit 5387eb0
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions strider/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,11 @@ async def sync_query(
# get max timeout
timeout_seconds = (query_dict.get("parameters") or {}).get("timeout_seconds")
# if timeout_seconds, less 10 seconds to account for sending back
timeout = timeout_seconds - 10 if type(timeout_seconds) is int else settings.max_process_time
timeout = (
timeout_seconds - 10
if type(timeout_seconds) is int
else settings.max_process_time
)
query_results = await asyncio.wait_for(lookup(query_dict, qid), timeout=timeout)
except asyncio.TimeoutError:
LOGGER.error(f"[{qid}] Sync query cancelled due to timeout.")
Expand Down Expand Up @@ -527,7 +531,11 @@ async def async_lookup(
# get max timeout
timeout_seconds = (query_dict.get("parameters") or {}).get("timeout_seconds")
# if timeout_seconds, less 10 seconds to account for sending back
timeout = timeout_seconds - 10 if type(timeout_seconds) is int else settings.max_process_time
timeout = (
timeout_seconds - 10
if type(timeout_seconds) is int
else settings.max_process_time
)
query_results = await asyncio.wait_for(lookup(query_dict, qid), timeout=timeout)
except asyncio.TimeoutError:
LOGGER.error(f"[{qid}]: Process cancelled due to timeout.")
Expand Down Expand Up @@ -562,7 +570,11 @@ async def single_lookup(query_key):
"timeout_seconds"
)
# if timeout_seconds, less 10 seconds to account for sending back
timeout = timeout_seconds - 10 if type(timeout_seconds) is int else settings.max_process_time
timeout = (
timeout_seconds - 10
if type(timeout_seconds) is int
else settings.max_process_time
)
query_result = await asyncio.wait_for(
lookup(queries[query_key], qid), timeout=timeout
)
Expand Down

0 comments on commit 5387eb0

Please sign in to comment.