Skip to content

Commit

Permalink
fix: catch exceptions when echoing fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Avram Tudor committed Oct 15, 2024
1 parent a1a074b commit 90c9bf2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions skynet/modules/ttt/summaries/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ async def echo_requests(request: Request, call_next):
counter = random.randrange(1, 101)

if counter <= echo_requests_percent:
await http_client.post(
f'{echo_requests_base_url}/{request.url.path}',
headers={'Authorization': f'Bearer {echo_requests_token}'},
json=await request.json(),
)
try:
await http_client.post(
f'{echo_requests_base_url}/{request.url.path}',
headers={'Authorization': f'Bearer {echo_requests_token}'},
json=await request.json(),
)
except Exception as e:
log.error(f'Failed to echo request: {e}')

return await call_next(request)

Expand Down

0 comments on commit 90c9bf2

Please sign in to comment.