Files
upload-platform/upload/backend/session/create_session.py
T

19 lines
460 B
Python

"""Создание сессии."""
import threading
import uuid
from .state import _lock, _sessions, _start_timer
def create_session() -> str:
"""Создать сессию и вернуть её уникальный идентификатор."""
sid = uuid.uuid4().hex
with _lock:
_sessions[sid] = {
"files": [],
"timer": _start_timer(sid),
"cancel": threading.Event(),
}
return sid