File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
src/dstack/_internal/server/background/tasks Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -54,17 +54,13 @@ async def process_submitted_gateways():
5454
5555
5656async def _remove_inactive_connections ():
57- connections = await gateway_connections_pool .all ()
58- ip_addresses = [c .ip_address for c in connections ]
5957 async with get_session_ctx () as session :
6058 res = await session .execute (
61- select (GatewayComputeModel ).where (
62- GatewayComputeModel .ip_address .in_ (ip_addresses ),
63- GatewayComputeModel .active == False ,
64- )
59+ select (GatewayComputeModel .ip_address ).where (GatewayComputeModel .active == True )
6560 )
66- removed_connections = res .scalars ().all ()
67- for conn in removed_connections :
61+ active_connection_ips = set (res .scalars ().all ())
62+ for conn in await gateway_connections_pool .all ():
63+ if conn .ip_address not in active_connection_ips :
6864 await gateway_connections_pool .remove (conn .ip_address )
6965
7066
You can’t perform that action at this time.
0 commit comments