Spaces:
Sleeping
Sleeping
chore(runtime): remove self-ping keepalive thread per request
Browse files
app.py
CHANGED
@@ -822,20 +822,5 @@ if __name__ == "__main__":
|
|
822 |
"ssr_mode": False # Disable experimental SSR in Docker env
|
823 |
}
|
824 |
|
825 |
-
# Lightweight keepalive (self-ping) to avoid idle shutdowns
|
826 |
-
try:
|
827 |
-
import threading, time, requests
|
828 |
-
def _keepalive():
|
829 |
-
url = "http://127.0.0.1:7860/"
|
830 |
-
while True:
|
831 |
-
try:
|
832 |
-
requests.get(url, timeout=3)
|
833 |
-
except Exception:
|
834 |
-
pass
|
835 |
-
time.sleep(60)
|
836 |
-
threading.Thread(target=_keepalive, daemon=True).start()
|
837 |
-
except Exception:
|
838 |
-
pass
|
839 |
-
|
840 |
# Enable queue for gradio_client compatibility
|
841 |
demo.queue().launch(**launch_kwargs) # ✅ required for gradio_client to work
|
|
|
822 |
"ssr_mode": False # Disable experimental SSR in Docker env
|
823 |
}
|
824 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
825 |
# Enable queue for gradio_client compatibility
|
826 |
demo.queue().launch(**launch_kwargs) # ✅ required for gradio_client to work
|