Spaces:
Runtime error
Runtime error
da03
commited on
Commit
·
6fa3785
1
Parent(s):
d4eaeb4
- dispatcher.py +3 -3
dispatcher.py
CHANGED
@@ -391,7 +391,7 @@ class SessionManager:
|
|
391 |
async def get_available_worker(self) -> Optional[WorkerInfo]:
|
392 |
"""Get an available worker"""
|
393 |
for worker in self.workers.values():
|
394 |
-
if worker.is_available and time.time() - worker.last_ping <
|
395 |
return worker
|
396 |
return None
|
397 |
|
@@ -1154,12 +1154,12 @@ async def periodic_analytics_summary():
|
|
1154 |
async def periodic_worker_health_check():
|
1155 |
while True:
|
1156 |
try:
|
1157 |
-
await asyncio.sleep(
|
1158 |
current_time = time.time()
|
1159 |
disconnected_workers = []
|
1160 |
|
1161 |
for worker_id, worker in list(session_manager.workers.items()):
|
1162 |
-
if current_time - worker.last_ping >
|
1163 |
disconnected_workers.append((worker_id, worker.worker_address))
|
1164 |
|
1165 |
for worker_id, worker_address in disconnected_workers:
|
|
|
391 |
async def get_available_worker(self) -> Optional[WorkerInfo]:
|
392 |
"""Get an available worker"""
|
393 |
for worker in self.workers.values():
|
394 |
+
if worker.is_available and time.time() - worker.last_ping < 20: # Worker ping timeout
|
395 |
return worker
|
396 |
return None
|
397 |
|
|
|
1154 |
async def periodic_worker_health_check():
|
1155 |
while True:
|
1156 |
try:
|
1157 |
+
await asyncio.sleep(15) # Check every 15 seconds
|
1158 |
current_time = time.time()
|
1159 |
disconnected_workers = []
|
1160 |
|
1161 |
for worker_id, worker in list(session_manager.workers.items()):
|
1162 |
+
if current_time - worker.last_ping > 20: # 20 second timeout
|
1163 |
disconnected_workers.append((worker_id, worker.worker_address))
|
1164 |
|
1165 |
for worker_id, worker_address in disconnected_workers:
|