From 1a519bbf4680da3ee94839618c451a49a343f24e Mon Sep 17 00:00:00 2001 From: dspeck1 Date: Mon, 30 Sep 2024 14:32:38 -0500 Subject: [PATCH] Remove bad import and unused code. --- src/main.py | 61 ----------------------------------------------------- 1 file changed, 61 deletions(-) diff --git a/src/main.py b/src/main.py index cddd659..7156624 100644 --- a/src/main.py +++ b/src/main.py @@ -11,7 +11,6 @@ from aiokafka import AIOKafkaConsumer # type:ignore from aiokafka import AIOKafkaProducer # type:ignore -from aiokafka import KafkaException from cloudevents.conversion import to_structured from cloudevents.http import CloudEvent import httpx @@ -106,64 +105,6 @@ async def fan_out_msg( finally: await producer.stop() - - -@REQUEST_TIME.time() -async def knative_request( - in_process_requests_gauge, - client: httpx.AsyncClient, - knative_serving_url: str, - headers: dict[str, str], - body: bytes, - info: str, -) -> None: - """Makes knative http request. - - Parameters - ---------- - client: `httpx.AsyncClient` - The async httpx client. - knative_serving_url : `string` - The url for the knative instance. - headers: dict[`str,'str'] - The headers to pass to knative. - body: `bytes` - The next visit message body. - info: `str` - Information such as some fields of the next visit message to identify - this request and to log with. - """ - in_process_requests_gauge.inc() - - result = await client.post( - knative_serving_url, - headers=headers, - data=body, # type:ignore - timeout=None, - ) - - logging.info( - f"nextVisit {info} status code {result.status_code} for initial request {result.content}" - ) - - ''' - if result.status_code == 502 or result.status_code == 503: - logging.info( - f"retry after status code {result.status_code} for nextVisit {info}" - ) - retry_result = await client.post( - knative_serving_url, - headers=headers, - data=body, # type:ignore - timeout=None, - ) - logging.info( - f"nextVisit {info} retried request {retry_result.content}" - ) - ''' - in_process_requests_gauge.dec() - - async def main() -> None: # Get environment variables @@ -175,8 +116,6 @@ async def main() -> None: expire = float(os.environ["MESSAGE_EXPIRATION"]) kafka_schema_registry_url = os.environ["KAFKA_SCHEMA_REGISTRY_URL"] latiss_knative_serving_url = os.environ["LATISS_KNATIVE_SERVING_URL"] - lsstcomcam_knative_serving_url = os.environ["LSSTCOMCAM_KNATIVE_SERVING_URL"] - lsstcomcamsim_knative_serving_url = os.environ["LSSTCOMCAMSIM_KNATIVE_SERVING_URL"] lsstcam_knative_serving_url = os.environ["LSSTCAM_KNATIVE_SERVING_URL"] hsc_knative_serving_url = os.environ["HSC_KNATIVE_SERVING_URL"]