fix(upload): параметризация pullRetries/pullRetryDelay/pullTimeout, configure лимитов/TTL, onStatus в init, логирование sid/name

This commit is contained in:
“Naeel”
2026-08-25 08:37:09 +03:00
parent 5711e97fe5
commit af172115b0
9 changed files with 64 additions and 29 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
"""add_file — добавить файл в сессию (с проверкой суммарного лимита)."""
from .state import _sessions, _lock, MAX_SESSION_BYTES
from . import state
def add_file(sid: str, filename: str, content: bytes) -> bool:
@@ -14,12 +14,12 @@ def add_file(sid: str, filename: str, content: bytes) -> bool:
Returns:
True если добавлено; False если сессии нет или превышен лимит сессии.
"""
with _lock:
s = _sessions.get(sid)
with state._lock:
s = state._sessions.get(sid)
if not s:
return False
total = sum(len(c) for _, c in s["files"])
if total + len(content) > MAX_SESSION_BYTES:
if total + len(content) > state.MAX_SESSION_BYTES:
return False # превышен суммарный лимит сессии
s["files"].append((filename, content))
return True