Skip to content

Commit 5897304

Browse files
committed
Update worker.py
1 parent 2320049 commit 5897304

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

runpod/serverless/worker.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,18 @@ async def run_worker(config: Dict[str, Any]) -> None:
9292
Args:
9393
config (Dict[str, Any]): Configuration parameters for the worker.
9494
"""
95-
connector = aiohttp.TCPConnector(limit=None)
96-
async with aiohttp.ClientSession(
97-
connector=connector, headers=_get_auth_header(), timeout=_TIMEOUT) as session:
95+
heartbeat.start_ping()
9896

97+
client_session = aiohttp.ClientSession(
98+
connector=aiohttp.TCPConnector(limit=None),
99+
headers=_get_auth_header(), timeout=_TIMEOUT
100+
)
101+
102+
async with client_session as session:
99103
job_scaler = JobScaler(
100104
concurrency_controller=config.get('concurrency_controller', None)
101105
)
102106

103-
heartbeat.start_ping()
104-
105107
while job_scaler.is_alive():
106108

107109
async for job in job_scaler.get_jobs(session):

0 commit comments

Comments
 (0)