Skip to content
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

A few small optimizations #369

Merged
merged 4 commits into from
Jul 25, 2023
Merged

A few small optimizations #369

merged 4 commits into from
Jul 25, 2023

Conversation

marcelveldt
Copy link
Contributor

Some small speedups and code cleanup

@marcelveldt marcelveldt added the maintenance Code (quality) improvement or small enhancement which not a new feature label Jul 25, 2023
@marcelveldt marcelveldt added maintenance Code (quality) improvement or small enhancement which not a new feature and removed maintenance Code (quality) improvement or small enhancement which not a new feature labels Jul 25, 2023
@marcelveldt marcelveldt merged commit 4a06580 into main Jul 25, 2023
@marcelveldt marcelveldt deleted the small-optimization branch July 25, 2023 15:58
@@ -409,7 +403,7 @@ async def read_attribute(
)
)
read_atributes = self._parse_attributes_from_read_result(result.attributes)
return read_atributes[attribute_path]
return read_atributes.get(attribute_path, None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None is the default value returned when the key is missing in the dict.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

read_attributes

node_lock = self._get_node_lock(node_id)
if self.chip_controller is None:
raise RuntimeError("Device Controller not initialized.")
try:
# the sdk crashes when multiple resolves happen at the same time
# guard simultane resolves with a lock.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simultaneous

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Code (quality) improvement or small enhancement which not a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants