-
Notifications
You must be signed in to change notification settings - Fork 257
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
should be exposed externally
#789
Comments
I don't really follow what you refer that when you say that it's Sure, of course |
The design seems to want me to use the subscription and update model in a separate thread, but this isn't necessarily always what one would want to do, for a couple of reasons, like race conditions (or more precisely being able to reason about the correctness of the program, ensuring it's free of race conditions), or when combined with wanting to query updates from the past, which requires you to ensure the metadata on the client is set to that past runtime's metadata. I feel like the current API is kind of working against me. Happy to open a PR to expose |
Ok, I see. As this API is a wrapper around the |
Might help if I explain the approach I was going to take. Basically the way I was going to work around this, is rather than to poll for metadata each time, just poll for runtime-version. If runtime version is different to the one in the client, only then would querying for metadata occur, and then it would be set to this in the client (using |
Put up #791 |
Just to check; the current API allows you to do something like this: let updater = client.subscribe_to_updates();
let runtime_update_stream = updater.runtime_updates();
// Just to show that we are subscribed to runtime updates; you may want to call `.next()` in your own time.
while let Ok(update) = runtime_update_stream.next().await {
// Once you have an update you can apply it when you choose:
updater.apply_update(update)?;
} I can see that The fields in |
Yeah, so that example works fine for when you only need to worry about runtimes going forward in time, but as soon as you need to query for events before the latest runtime, it's not clear the best way to do that with the current API. You almost need to split the logic, which is what I'm trying to avoid. By querying runtime-version each time and maybe Good point re: the fields not being |
In general, the OnlineClient is much too opinionated about how runtime updates should be handled, a small thing that would help this is allowing us to pass in an
Update
toapply_update
. This method is currently public, but it can't be passed inUpdate
to call it from outside, effectively making it private.The text was updated successfully, but these errors were encountered: