Spaces:
Running
Running
Fix preview app 502 errors by preventing unnecessary restarts
Browse files
app.py
CHANGED
@@ -75,6 +75,12 @@ def stop_preview_app():
|
|
75 |
def start_preview_app():
|
76 |
"""Start the preview app in a subprocess if it's not already running."""
|
77 |
global preview_process
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
# Stop any existing process before starting a new one
|
79 |
stop_preview_app()
|
80 |
|
|
|
75 |
def start_preview_app():
|
76 |
"""Start the preview app in a subprocess if it's not already running."""
|
77 |
global preview_process
|
78 |
+
|
79 |
+
# Check if preview app is already running
|
80 |
+
if preview_process and preview_process.poll() is None:
|
81 |
+
print(f"✅ Preview app already running (PID: {preview_process.pid})")
|
82 |
+
return True, f"Preview running at {PREVIEW_URL}"
|
83 |
+
|
84 |
# Stop any existing process before starting a new one
|
85 |
stop_preview_app()
|
86 |
|