Spaces:
Sleeping
Sleeping
Factor Studios
commited on
Upload test_ai_integration.py
Browse files- test_ai_integration.py +1 -5
test_ai_integration.py
CHANGED
|
@@ -68,8 +68,7 @@ def websocket_manager(max_retries=5, retry_delay=2, timeout=30.0):
|
|
| 68 |
raise RuntimeError(error_msg)
|
| 69 |
|
| 70 |
try:
|
| 71 |
-
#
|
| 72 |
-
storage.set_keep_alive(True)
|
| 73 |
yield storage
|
| 74 |
except Exception as e:
|
| 75 |
logging.error(f"WebSocket operation failed: {e}")
|
|
@@ -82,7 +81,6 @@ def websocket_manager(max_retries=5, retry_delay=2, timeout=30.0):
|
|
| 82 |
finally:
|
| 83 |
if storage:
|
| 84 |
try:
|
| 85 |
-
storage.set_keep_alive(False)
|
| 86 |
storage.close()
|
| 87 |
except:
|
| 88 |
pass
|
|
@@ -243,7 +241,6 @@ def test_ai_integration():
|
|
| 243 |
if (components['storage'] and
|
| 244 |
components['storage'].wait_for_connection(timeout=10.0)):
|
| 245 |
shared_storage = components['storage']
|
| 246 |
-
shared_storage.set_keep_alive(True) # Enable keep-alive
|
| 247 |
logging.info("Successfully reused existing WebSocket connection")
|
| 248 |
break
|
| 249 |
else:
|
|
@@ -252,7 +249,6 @@ def test_ai_integration():
|
|
| 252 |
if new_storage and new_storage.wait_for_connection(timeout=10.0):
|
| 253 |
components['storage'] = new_storage
|
| 254 |
shared_storage = new_storage
|
| 255 |
-
shared_storage.set_keep_alive(True) # Enable keep-alive
|
| 256 |
logging.info("Successfully established new WebSocket connection")
|
| 257 |
break
|
| 258 |
except Exception as e:
|
|
|
|
| 68 |
raise RuntimeError(error_msg)
|
| 69 |
|
| 70 |
try:
|
| 71 |
+
# Yield the storage connection
|
|
|
|
| 72 |
yield storage
|
| 73 |
except Exception as e:
|
| 74 |
logging.error(f"WebSocket operation failed: {e}")
|
|
|
|
| 81 |
finally:
|
| 82 |
if storage:
|
| 83 |
try:
|
|
|
|
| 84 |
storage.close()
|
| 85 |
except:
|
| 86 |
pass
|
|
|
|
| 241 |
if (components['storage'] and
|
| 242 |
components['storage'].wait_for_connection(timeout=10.0)):
|
| 243 |
shared_storage = components['storage']
|
|
|
|
| 244 |
logging.info("Successfully reused existing WebSocket connection")
|
| 245 |
break
|
| 246 |
else:
|
|
|
|
| 249 |
if new_storage and new_storage.wait_for_connection(timeout=10.0):
|
| 250 |
components['storage'] = new_storage
|
| 251 |
shared_storage = new_storage
|
|
|
|
| 252 |
logging.info("Successfully established new WebSocket connection")
|
| 253 |
break
|
| 254 |
except Exception as e:
|