Implement reusable upload platform
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
"""Создание сессии."""
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user