-
-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Hi @whitphx
Thank you so much for the repo!
I am building an annotation interface and I am using global locks to make sure that concurrent users are not annotating the same data.
Here is a super minimal snippet for this. Basic idea is that concurrent users should get different i displayed on their interface.
However, some simple testing shows that multiple session will see the same i. In my case, I see i = 0 in the first session, i =1 in second, third, fourth session ...
Do you have any idea what's going on here? Any fix you'd recommend?
Thank you so much!
import streamlit as st
from streamlit_server_state import server_state_lock
for i in range(10):
if server_state_lock[f"{i}"].acquire(blocking=False):
print(f"Acquired lock for {i}")
break
else:
print(f"Failed to acquire lock for {i}")
continue
st.write("Count = ", i)
# create a submit button and refresh the page when the button is clicked
if st.button("Submit"):
server_state_lock[f"{i}"].release()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels