mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Add preference for non 404 responses fix test RC.
Fixed race condition with the 404 test.
This commit is contained in:
parent
c302f113b0
commit
5fe7e42d1a
2 changed files with 22 additions and 3 deletions
|
|
@ -222,6 +222,7 @@ class AsyncParallelTransport(httpx.AsyncBaseTransport):
|
|||
self,
|
||||
request: httpx.Request,
|
||||
) -> httpx.Response:
|
||||
# pylint: disable=too-many-branches
|
||||
"""Issue parallel requests to all sub-transports.
|
||||
|
||||
Return the response of the first completed.
|
||||
|
|
@ -254,7 +255,9 @@ class AsyncParallelTransport(httpx.AsyncBaseTransport):
|
|||
for task in done:
|
||||
try:
|
||||
result = task.result()
|
||||
if not result.is_error or result.status_code == 404:
|
||||
if not result.is_error:
|
||||
response = result
|
||||
elif result.status_code == 404 and response is None:
|
||||
response = result
|
||||
elif not error_response:
|
||||
self._logger.warning("Error response: %s for %s", result.status_code, request.url)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue