Increase the max duration of session to 90 seconds
#3
by
sam-humeau-mistral
- opened
app.py
CHANGED
|
@@ -31,7 +31,7 @@ SAMPLE_RATE = 16_000
|
|
| 31 |
WARMUP_DURATION = 2.0 # seconds of silence for warmup
|
| 32 |
WPM_WINDOW = 10 # seconds for running mean calculation
|
| 33 |
CALIBRATION_PERIOD = 5 # seconds before showing WPM
|
| 34 |
-
SESSION_TIMEOUT = int(os.environ.get("SESSION_TIMEOUT", "
|
| 35 |
INACTIVITY_TIMEOUT = int(os.environ.get("INACTIVITY_TIMEOUT", "10")) # Close after 10s silence
|
| 36 |
MAX_CONCURRENT_SESSIONS = int(os.environ.get("MAX_SESSIONS", "50"))
|
| 37 |
|
|
@@ -53,8 +53,8 @@ _sessions_lock = threading.Lock()
|
|
| 53 |
_session_registry = {}
|
| 54 |
_registry_lock = threading.Lock()
|
| 55 |
_last_cleanup = time.time()
|
| 56 |
-
SESSION_REGISTRY_CLEANUP_INTERVAL =
|
| 57 |
-
SESSION_MAX_AGE =
|
| 58 |
|
| 59 |
|
| 60 |
def get_or_create_session(session_id: str = None) -> "UserSession":
|
|
|
|
| 31 |
WARMUP_DURATION = 2.0 # seconds of silence for warmup
|
| 32 |
WPM_WINDOW = 10 # seconds for running mean calculation
|
| 33 |
CALIBRATION_PERIOD = 5 # seconds before showing WPM
|
| 34 |
+
SESSION_TIMEOUT = int(os.environ.get("SESSION_TIMEOUT", "95")) # Max 90s per session
|
| 35 |
INACTIVITY_TIMEOUT = int(os.environ.get("INACTIVITY_TIMEOUT", "10")) # Close after 10s silence
|
| 36 |
MAX_CONCURRENT_SESSIONS = int(os.environ.get("MAX_SESSIONS", "50"))
|
| 37 |
|
|
|
|
| 53 |
_session_registry = {}
|
| 54 |
_registry_lock = threading.Lock()
|
| 55 |
_last_cleanup = time.time()
|
| 56 |
+
SESSION_REGISTRY_CLEANUP_INTERVAL = 90 # seconds
|
| 57 |
+
SESSION_MAX_AGE = 90 # 90 seconds - remove sessions older than this
|
| 58 |
|
| 59 |
|
| 60 |
def get_or_create_session(session_id: str = None) -> "UserSession":
|