forked from kenzuya/unshackle
refactor(api): remove dead code paths in serve/remote layer
Delete code paths that never executed in the serve/API/remote stack: - BridgeCancelledError: raised but never caught; replace raises with RuntimeError and drop the class. - InputBridge.error setter and _error field: written at the handler layer, never read (session.auth_error is the surfaced channel). - cancel_event param and _check_cancel inner fn on _perform_download: the only caller always passed None (the live job.cancel_event is untouched). - result_with_progress monkeypatch: its status pings were redundant with the file-polled progress_sink, which is now the sole path. - session param on _resolve_manifest_data: unused in the body. Reconcile SessionStore's hardcoded 600s auth-state TTL into a shared AUTH_INPUT_TIMEOUT constant referenced by both the InputBridge input timeout and the store, removing the magic number without changing the longer grace window. Update input_bridge/session_store tests for the new channels and add an assertion that auth-state entries expire at the single rule.
This commit is contained in:
@@ -14,7 +14,7 @@ from dataclasses import dataclass, field
|
||||
from datetime import datetime, timezone
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from unshackle.core.api.input_bridge import AuthStatus, InputBridge
|
||||
from unshackle.core.api.input_bridge import AUTH_INPUT_TIMEOUT, AuthStatus, InputBridge
|
||||
from unshackle.core.api.sanitize import sanitize_log
|
||||
from unshackle.core.config import config
|
||||
from unshackle.core.tracks import Track
|
||||
@@ -127,7 +127,7 @@ class SessionStore:
|
||||
for sid, entry in self._sessions.items():
|
||||
elapsed = (now - entry.last_accessed).total_seconds()
|
||||
if entry.auth_status in (AuthStatus.AUTHENTICATING, AuthStatus.PENDING_INPUT):
|
||||
if elapsed > 600:
|
||||
if elapsed > AUTH_INPUT_TIMEOUT:
|
||||
expired.append(sid)
|
||||
elif elapsed > self._ttl:
|
||||
expired.append(sid)
|
||||
|
||||
Reference in New Issue
Block a user