Skip to content

Commit

Permalink
Create the index first
Browse files Browse the repository at this point in the history
  • Loading branch information
lalinsky committed Dec 6, 2024
1 parent 0518f2a commit 7bda874
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions legacy-proxy/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,15 @@ def __init__(self, target):
self.index_name = "main"
self.index_url = target

async def create_index(self):
url = self.index_url + f"/{self.index_name}"
async with self.session.put(url) as resp:
resp.raise_for_status()

async def serve(self, listen_host, listen_port):
async with aiohttp.ClientSession() as session:
self.session = session
await self.create_index()
server = await asyncio.start_server(
self.handle_connection, listen_host, listen_port
)
Expand Down

0 comments on commit 7bda874

Please sign in to comment.