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

Simplify implementation of item equality #87

Merged
merged 1 commit into from
Feb 13, 2025
Merged

Conversation

complexspaces
Copy link
Collaborator

As discussed in #82, the current implementation seems non-ideal because it, intentionally or not, compares item paths and fetches their attributes at the same time once the paths are equal. Since all the fetching is done "just in time" and not from previously cached value on Item, these calls would always return the same attributes since the paths are also the same.

As this behavior has been in master for years now (seemingly without issue), it seems unlikely that anyone has run into the case where the path changes silently due to a provider change while an Item object is alive. If someone raises this issue later it can be evaluated then and fixed whenever the next major release of zbus comes out to accompany the breaking change required.

Additionally this PR takes advantage of the fact that the async Item implementation no longer needs to make calls via .await and implements PartialEq for the item instead to more closely match the blocking Item public API.

Closes #82

@complexspaces complexspaces merged commit c9d6e0f into master Feb 13, 2025
13 checks passed
@complexspaces complexspaces deleted the simplify-eq branch February 13, 2025 06:30
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.

Implementation of item.equal_to seems inefficient
1 participant