Skip to content

Commit

Permalink
implicit single connection
Browse files Browse the repository at this point in the history
  • Loading branch information
George Burton committed Apr 13, 2024
1 parent bfcfd65 commit 4794b8b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions core_api/src/routes/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

# === Queues ===
router = RedisRouter(url=env.redis_url)
publisher = router.publisher(env.ingest_queue_name)


# === Storage ===
Expand Down Expand Up @@ -54,7 +53,7 @@ async def create_upload_file(name: str, type: str, location: AnyHttpUrl) -> UUID
Args:
name (str): The file name to be recorded
type (str): The file type to be recorded
location (AnyHttpUrl): The presigned file resource location
location (AnyHttpUrl): The pre-signed file resource location
Returns:
UUID: The file uuid from the elastic database
Expand All @@ -69,8 +68,7 @@ async def create_upload_file(name: str, type: str, location: AnyHttpUrl) -> UUID
storage_handler.write_item(file)

log.info(f"publishing {file.uuid}")
await router.broker.connect()
await publisher.publish(file)
await router.broker.publish(file, env.ingest_queue_name)

return file.uuid

Expand Down

0 comments on commit 4794b8b

Please sign in to comment.