mirror of
https://github.com/facefusion/facefusion.git
synced 2026-05-09 09:25:36 +02:00
a829742cba
* Add simple session context * Add simple session context
19 lines
402 B
Python
19 lines
402 B
Python
from contextvars import ContextVar
|
|
from typing import Optional
|
|
|
|
from facefusion.types import SessionId
|
|
|
|
SESSION_ID : ContextVar[Optional[SessionId]] = ContextVar('SESSION_ID', default = None)
|
|
|
|
|
|
def set_session_id(session_id : SessionId) -> None:
|
|
SESSION_ID.set(session_id)
|
|
|
|
|
|
def get_session_id() -> Optional[SessionId]:
|
|
return SESSION_ID.get()
|
|
|
|
|
|
def clear_session_id() -> None:
|
|
SESSION_ID.set(None)
|