Skip to content

Conversation

@mwerezak
Copy link
Contributor

@mwerezak mwerezak commented May 14, 2025

Cleaned up some obvious issues in the code.

  • Serialize async callbacks using an actual threading.Lock instead of an error-prone bool. <<< This is probably the most important improvement. The way it was before, if an exception is thrown the device will be stuck permanently "in progress"
  • Make kwargs explicit in function signature.
  • Remove dead branch, dict.get() will never raise KeyError.
  • Replaced commented out try/catch. Close and remove connection if a ConnectionError is raised (while ensuring exception does not get silenced), remove redundant logging call.
  • Replace the potentially fragile self-mutating current_selection system with a CommandBuilder class. This makes running a command a more pure computation with all of the mutation happening inside CommandBuilder only. Removed DeviceDuplicate as it no longer serves any useful purpose (you can just duplicate the CommandBuilder object directly).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant