Spaces:
Sleeping
Sleeping
Déploiement automatique depuis GitLab CI
Browse files- MistralChat.py +3 -3
MistralChat.py
CHANGED
|
@@ -9,7 +9,7 @@ import logfire
|
|
| 9 |
|
| 10 |
|
| 11 |
# ---------------------------------------------------------------------------
|
| 12 |
-
# Keep-alive côté serveur : thread daemon qui se ping lui-même toutes les
|
| 13 |
# Fonctionne même si aucun navigateur n'a la page ouverte.
|
| 14 |
# L'URL cible est lue depuis la variable d'environnement STREAMLIT_URL
|
| 15 |
# (par défaut http://localhost:7860).
|
|
@@ -19,7 +19,7 @@ import logfire
|
|
| 19 |
# démarrerait son propre thread keep-alive en parallèle.
|
| 20 |
# ---------------------------------------------------------------------------
|
| 21 |
_KEEPALIVE_WARMUP_S = 60 # délai avant le 1er ping (laisse Streamlit démarrer)
|
| 22 |
-
_KEEPALIVE_MIN_INTERVAL_S =
|
| 23 |
_KEEPALIVE_PIDFILE = "/tmp/.streamlit_keepalive.pid"
|
| 24 |
|
| 25 |
|
|
@@ -66,7 +66,7 @@ def _start_keepalive() -> None:
|
|
| 66 |
pass # /tmp non accessible — on démarre quand même sans protection fichier
|
| 67 |
|
| 68 |
url = os.getenv("STREAMLIT_URL", "http://localhost:7860")
|
| 69 |
-
interval = int(os.getenv("KEEPALIVE_INTERVAL_S", str(
|
| 70 |
effective = max(interval, _KEEPALIVE_MIN_INTERVAL_S)
|
| 71 |
t = threading.Thread(target=_keepalive_loop, args=(url, interval), daemon=True, name="streamlit-keepalive")
|
| 72 |
t.start()
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
# ---------------------------------------------------------------------------
|
| 12 |
+
# Keep-alive côté serveur : thread daemon qui se ping lui-même toutes les 25 min
|
| 13 |
# Fonctionne même si aucun navigateur n'a la page ouverte.
|
| 14 |
# L'URL cible est lue depuis la variable d'environnement STREAMLIT_URL
|
| 15 |
# (par défaut http://localhost:7860).
|
|
|
|
| 19 |
# démarrerait son propre thread keep-alive en parallèle.
|
| 20 |
# ---------------------------------------------------------------------------
|
| 21 |
_KEEPALIVE_WARMUP_S = 60 # délai avant le 1er ping (laisse Streamlit démarrer)
|
| 22 |
+
_KEEPALIVE_MIN_INTERVAL_S = 1500 # intervalle minimum entre deux pings (25 min)
|
| 23 |
_KEEPALIVE_PIDFILE = "/tmp/.streamlit_keepalive.pid"
|
| 24 |
|
| 25 |
|
|
|
|
| 66 |
pass # /tmp non accessible — on démarre quand même sans protection fichier
|
| 67 |
|
| 68 |
url = os.getenv("STREAMLIT_URL", "http://localhost:7860")
|
| 69 |
+
interval = int(os.getenv("KEEPALIVE_INTERVAL_S", str(25 * 60))) # défaut : 25 min
|
| 70 |
effective = max(interval, _KEEPALIVE_MIN_INTERVAL_S)
|
| 71 |
t = threading.Thread(target=_keepalive_loop, args=(url, interval), daemon=True, name="streamlit-keepalive")
|
| 72 |
t.start()
|