Skip to content

Commit

Permalink
Remove bad import and unused code.
Browse files Browse the repository at this point in the history
  • Loading branch information
dspeck1 committed Sep 30, 2024
1 parent 8bf2fb4 commit 1a519bb
Showing 1 changed file with 0 additions and 61 deletions.
61 changes: 0 additions & 61 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"]

Expand Down

0 comments on commit 1a519bb

Please sign in to comment.