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

Update properties cache & notify property streams on service going up #1172

Open
zeenix opened this issue Dec 6, 2024 · 4 comments
Open
Labels
bug Something isn't working zbus Issues/PRs related to zbus crate

Comments

@zeenix
Copy link
Contributor

zeenix commented Dec 6, 2024

Currently if a service is down when you create a proxy and property streams with it, you won't get the values of the properties or get notified of property changes when the service goes up. A similar thing happens if the service goes down after a successful properties' cache update and notifications: after re-launch the cached values will most likely now be obsolete and need to be re-fetched.

@zeenix zeenix added bug Something isn't working zbus Issues/PRs related to zbus crate labels Dec 6, 2024
@petewasher-flybrid
Copy link

Hello, is there any work around for this issue? What should I do in the code to make sure the service is alive before creating an instance of the proxy (and the case where the proxy goes down)?

I am using this in an embedded system where the startup of various services cannot be entirely managed (sometimes it is dependent on connectivity being available for example).

@zeenix
Copy link
Contributor Author

zeenix commented Feb 25, 2025

Hello, is there any work around for this issue?

You can always use the low-level APIs (which aren't super low-level) through Connection and MessageStream etc.

I am using this in an embedded system where the startup of various services cannot be entirely managed (sometimes it is dependent on connectivity being available for example).

Thanks for sharing your use case but please understand that it can't have any affect on my priorities. On the bright side, I don't think this will be a big effort so if you really need this, please consider contributing a fix.

@petewasher-flybrid
Copy link

Thanks for your insight - don't worry I wasn't somehow expecting you to jump on this and magically fix it just for me :)

In the end I have worked around it by periodically trying to create a new proxy connection and verifying that it can talk to the service. If that fails, then the original thread awaiting events from the service is terminated and I loop waiting for the service to re-appear.

What pattern did you have in mind for trapping this? I see you already subscribe to NameOwnerChanged, would it also need subscriptions to NameLost and NameAcquired signals to trap the shutdown / startup of the service?

@zeenix
Copy link
Contributor Author

zeenix commented Feb 26, 2025

Thanks for your insight

NP.

don't worry I wasn't somehow expecting you to jump on this and magically fix it just for me :)

I'm sorry that I got the wrong idea but your comment did seem like one of those "hey, I'm also facing this issue" kind of comments that are rarely helpful.

I see you already subscribe to NameOwnerChanged

It's only done on demand and doesn't do anything with the properties cache. Perhaps properties caching code needs to subscribe the proxy as well. I have not yet given it a lot of thought since that would be most of the work. :)

would it also need subscriptions to NameLost and NameAcquired signals

  1. Those signals are only sent to the peer that lost or acquired the name.
  2. They don't give any new information than NameOwnerChanged signal already does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working zbus Issues/PRs related to zbus crate
Projects
None yet
Development

No branches or pull requests

2 participants