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

runtime upgrades API: provide low-level API #652

Closed
niklasad1 opened this issue Sep 14, 2022 · 1 comment · Fixed by #657
Closed

runtime upgrades API: provide low-level API #652

niklasad1 opened this issue Sep 14, 2022 · 1 comment · Fixed by #657
Assignees

Comments

@niklasad1
Copy link
Member

niklasad1 commented Sep 14, 2022

Currently, it's only possible perform runtime upgrades as follows:

tokio::spawn(async move {
	let update_client = api2.subscribe_to_updates();

	// This will run runtime updates in a loop which only returns if the RPC subscription is terminated.
	if let Err(e) = match update_client.perform_runtime_updates().await {
	    log::error!(target: LOG_TARGET, "Runtime update failed with result: {:?}", e);
		let _ = tx_runtime.send(e);
	}
});

subxt spawns a loop performs upgrades under the hood but I would want to know when a runtime upgrade occurred to provide some kind of metrics for it.

I think the current API is good but having a low-level API or some impl Stream wrapper that fires every time a runtime upgrade occurs.

@jsdw
Copy link
Collaborator

jsdw commented Sep 14, 2022

Makes sense to me to have a Stream that maybe has the version info in and that perform_runtime_updates can be a super simple wrapper around!

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 a pull request may close this issue.

2 participants