Update app.py
Browse files
app.py
CHANGED
|
@@ -328,7 +328,7 @@ def upload_to_hf_and_remove(folder_path):
|
|
| 328 |
|
| 329 |
|
| 330 |
def cleanup_sandboxes():
|
| 331 |
-
"""Remove sandboxes that haven't been accessed for
|
| 332 |
current_time = time.time()
|
| 333 |
sandboxes_to_remove = []
|
| 334 |
|
|
@@ -365,6 +365,8 @@ def get_or_create_sandbox(session_uuid):
|
|
| 365 |
print(f"Reusing Sandbox for {session_uuid}")
|
| 366 |
SANDBOX_METADATA[session_uuid]["last_accessed"] = current_time
|
| 367 |
return SANDBOXES[session_uuid]
|
|
|
|
|
|
|
| 368 |
|
| 369 |
if session_uuid in SANDBOXES:
|
| 370 |
try:
|
|
|
|
| 328 |
|
| 329 |
|
| 330 |
def cleanup_sandboxes():
|
| 331 |
+
"""Remove sandboxes that haven't been accessed for longer than SANDBOX_TIMEOUT"""
|
| 332 |
current_time = time.time()
|
| 333 |
sandboxes_to_remove = []
|
| 334 |
|
|
|
|
| 365 |
print(f"Reusing Sandbox for {session_uuid}")
|
| 366 |
SANDBOX_METADATA[session_uuid]["last_accessed"] = current_time
|
| 367 |
return SANDBOXES[session_uuid]
|
| 368 |
+
else:
|
| 369 |
+
print("No sandbox found, creating a new one")
|
| 370 |
|
| 371 |
if session_uuid in SANDBOXES:
|
| 372 |
try:
|