-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make BlockingClient send thread safe #97
Conversation
Using the same BlockingClient to send command wasn't thread safe. Responses from commands sent from different threads could be mixed. Avoid this issue by using a lock.
Missing f for f-string
I see it failed again in CI. I think it would be better to use the official repo I could fix that in a separate PR or in this one. |
2f592fc
to
3c33fc9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #97 +/- ##
=======================================
Coverage 97.19% 97.20%
=======================================
Files 12 12
Lines 1212 1215 +3
=======================================
+ Hits 1178 1181 +3
Misses 34 34 ☔ View full report in Codecov by Sentry. |
Linting, and CI, are changed upstream in the copier template. The short answer is, until we investigate using uv lockfiles it'll be using the local version which can be pinned in a given project's The locally installed ruff that |
Going to merge and make a new PR with the newer ruff version's changes. |
Thanks for the explanation. I usually don't use Same for The changes I had were the same as what you pushed in #98 Anyway, thanks for merging! Do you plan on making a new release soon? |
I think it's time for a patch release, will do now! Though might take rerunning copier for a fix to our release CI.
Makes sense, we'll be investigating package managers with lockfiles. For now we're settling for consistency in |
At MAX IV we use the
BlockingClient
in several sardana controllers.The same client is used in different methods to send commands. Sardana automatically runs some of those methods in a separate threads. We sometimes get an exception raised from the
pandablocks
library:In this case we got a response from a command that was sent from a different thread.
We can fix that by setting a lock in our code but it would be much nicer to fix it in the library.
I added a lock in the send method to make it thread safe.
I also fixed in this MR a typo:
f
was missing for the"Already got response for {command}"
f-string.