Skip to content

Commit

Permalink
Update sky/serve/load_balancer.py
Browse files Browse the repository at this point in the history
Co-authored-by: Zhanghao Wu <[email protected]>
  • Loading branch information
cblmemo and Michaelvll authored May 8, 2024
1 parent b43efda commit 484d08b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sky/serve/load_balancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ def _sync_with_controller(self):
self._client_pool[replica_url] = (
httpx.AsyncClient(
base_url=f'http://{replica_url}'))
closed_urls = []
for replica_url, client in self._client_pool.items():
if replica_url not in ready_replica_urls:
asyncio.run(client.aclose())
closed_urls.append(replica_url)
for replica_url in closed_urls:
del self._client_pool[replica_url]
urls_to_close = set(self._client_pool.keys()) - set(ready_replica_urls)
client_to_close = []
for replica_url in urls_to_close:
client_to_close.append(self._client_pool.pop(replica_url))
for client in client_to_close:
asyncio.run(client.aclose())

time.sleep(constants.LB_CONTROLLER_SYNC_INTERVAL_SECONDS)

async def _proxy_request_to(
Expand Down

0 comments on commit 484d08b

Please sign in to comment.