From e8ea5f077f92d7a1c71c5f4a233e443f86a11640 Mon Sep 17 00:00:00 2001 From: Neil Dwyer Date: Thu, 14 Dec 2023 15:55:52 -0800 Subject: [PATCH] fix small issue --- livekit-rtc/livekit/rtc/_ffi_client.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/livekit-rtc/livekit/rtc/_ffi_client.py b/livekit-rtc/livekit/rtc/_ffi_client.py index 430100de..ad1097d6 100644 --- a/livekit-rtc/livekit/rtc/_ffi_client.py +++ b/livekit-rtc/livekit/rtc/_ffi_client.py @@ -160,12 +160,16 @@ def to_python_level(level: proto_ffi.LogLevel.ValueType) -> int: raise Exception("unreachable") +_ffi_instance: Optional["FfiClient"] = None + + class FfiClient: @classproperty def instance(self): - if self._instance is None: - self._instance = FfiClient() - return self._instance + global _ffi_instance + if _ffi_instance is None: + _ffi_instance = FfiClient() + return _ffi_instance def __init__(self) -> None: self._lock = threading.RLock()