Doubts about how the lockdown works #288
-
Hi! I have a doubts about how the lockdown works. I had some problems trying to use multiple monitors at the same time, I'm currently using the same lockdown. To solve this, I had to instantiate a lockdown for each monitor, do you know why I have to do this? I'm parallelizing the code in threads and my monitor using the same lockdown. In some cases I just get no information and in others I get a connection error (ConnectionFailedError) Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The implementation currently isn't thread safe. More specifically, if a connection becomes idle for over a minute, then the next request will reconnect (since lockdownd disconnects idle client automatically). That means that if a thread will attempt something while the connection is re-established that will lead to some undefined behavior. I advise keep using a dedicated connection instance per thread. Also, if you would like you are more than welcome to create a PR that adds a locking decorator to resolve this issue 😃 |
Beta Was this translation helpful? Give feedback.
The implementation currently isn't thread safe. More specifically, if a connection becomes idle for over a minute, then the next request will reconnect (since lockdownd disconnects idle client automatically).
That means that if a thread will attempt something while the connection is re-established that will lead to some undefined behavior.
I advise keep using a dedicated connection instance per thread. Also, if you would like you are more than welcome to create a PR that adds a locking decorator to resolve this issue 😃