Skip to content

Commit

Permalink
refactor: do not return response object
Browse files Browse the repository at this point in the history
  • Loading branch information
JoanFM committed Sep 12, 2024
1 parent 6caf84c commit c65a106
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion jina/clients/base/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ async def send_message(self, request: 'Request'):
r_str = await response.json()
except aiohttp.ContentTypeError:
r_str = await response.text()
r_status = response.status
handle_response_status(response.status, r_str, self.url)
return response
return r_status, r_str
except (ValueError, ConnectionError, BadClient, aiohttp.ClientError, aiohttp.ClientConnectionError) as err:
self.logger.debug(f'Got an error: {err} sending POST to {self.url} in attempt {attempt}/{self.max_attempts}')
await retry.wait_or_raise_err(
Expand Down
4 changes: 1 addition & 3 deletions jina/clients/base/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,7 @@ def _result_handler(result):
async for response in streamer.stream(
request_iterator=request_iterator, results_in_order=results_in_order
):
r_status = response.status

r_str = await response.json()
r_status, r_str = response
handle_response_status(r_status, r_str, url)

da = None
Expand Down

0 comments on commit c65a106

Please sign in to comment.