Skip to content

Commit

Permalink
fix(endpoint): remove multiple-exception catch
Browse files Browse the repository at this point in the history
Does not work in python3.7
  • Loading branch information
nritsche authored and jrs65 committed Apr 8, 2020
1 parent 9a7f9a7 commit ff74f47
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions coco/endpoint.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
"""coco endpoint module."""
from aiohttp import (
ClientResponseError,
ClientConnectionError,
ClientTimeout,
ClientSession,
ContentTypeError,
)
Expand All @@ -14,7 +11,6 @@

import json
from pydoc import locate
import requests
import sanic

from . import Result, ExternalForward, CocoForward, metric
Expand Down Expand Up @@ -568,13 +564,9 @@ def client_send_request(host, port, metrics_port, args):
async def print_queue_size(metric_request_count):
try:
q_size = await metric.get("coco_queue_length_total", metrics_port)
except (
ClientResponseError,
ClientConnectionError,
ClientTimeout,
InternalError,
) as err:
print(f"Couldn't get queue fill level from cocod: {err}")
except Exception as err:
if not isinstance(err, asyncio.CancelledError):
print(f"Couldn't get queue fill level from cocod: {err}")
return
print(
f"\rThere are {int(q_size)} requests in the queue.",
Expand Down Expand Up @@ -627,7 +619,7 @@ async def request_and_wait():
)
if main_request in done:
queue_size.cancel()
print("/n")
print("\n")
break

# Wait a moment before getting metric again
Expand Down

0 comments on commit ff74f47

Please sign in to comment.