Skip to content

Commit 0cdf51c

Browse files
committed
Use a single lock instance so access is exclusive
Signed-off-by: Joe Friedrichsen <[email protected]>
1 parent 058ca3f commit 0cdf51c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/nipanel/streamlit_refresh/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from streamlit.components.v1.custom_component import CustomComponent
1111

1212

13+
_grpc_client_lock = threading.RLock()
1314
_panel_service_proxy_location: str | None = None
1415

1516

@@ -26,7 +27,8 @@ def initialize_refresh_component(panel_id: str) -> CustomComponent:
2627

2728

2829
def _get_or_resolve_proxy() -> str:
29-
with threading.RLock():
30+
global _grpc_client_lock
31+
with _grpc_client_lock:
3032
global _panel_service_proxy_location
3133
if _panel_service_proxy_location is None:
3234
with GrpcChannelPool() as grpc_channel_pool:

0 commit comments

Comments
 (0)