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

refactor: replace reconnecting-jsonrpsee-ws-client with subxt-reconnecting-rpc-client #1705

Merged
merged 15 commits into from
Aug 27, 2024

Conversation

niklasad1
Copy link
Member

@niklasad1 niklasad1 commented Aug 6, 2024

This PR removes the dependency reconnecting-rpc-client because it has some more complexity that subxt doesn't need and adds a simple reconnecting-wrapper-rpc-client however it's a some lines of code but I think it's quite simple and clean. Thus, it shouldn't that much technical debt

@@ -112,6 +112,10 @@ getrandom = { workspace = true, optional = true }
# Included if "native" feature is enabled
tokio-util = { workspace = true, features = ["compat"], optional = true }

# Included if the reconnecting rpc client feature is enabled
tokio = { workspace = true, optional = true }
Copy link
Member Author

Choose a reason for hiding this comment

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

Clean up tokio, perhaps we can replace it with futures channels and stuff

Copy link
Collaborator

Choose a reason for hiding this comment

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

We'll prob want a tokio feature flag or similar anyway so that we can make it easy to start up the UnstableBackend etc!

I see web enabled tokio?/sync; would webandtokio/sync` work together though?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, tokio/sync works for wasm/web but that could easily be replaced by futures channel

Copy link
Member Author

Choose a reason for hiding this comment

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

I forgot that I used tokio::sync::Notify so I prefer to keep tokio but not runtime agnostic but it's doesn't matter anyway because jsonrpsee is already using tokio channels.

We could change that though if becomes an issue.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yup I don't mind that it uses tokio since jsonrpsee does anyway, so we don't really gain anything by trying to remove it anyways from this I guess!

@niklasad1 niklasad1 changed the title wip: add native subxt rpc reconn client client: integrate subxt-reconnecting-rpc-client Aug 22, 2024
@niklasad1 niklasad1 marked this pull request as ready for review August 22, 2024 08:23
@niklasad1 niklasad1 requested a review from a team as a code owner August 22, 2024 08:23
@niklasad1 niklasad1 changed the title client: integrate subxt-reconnecting-rpc-client refactor: replace reconnecting-jsonrpsee-ws-client with subxt-reconnecting-rpc-client Aug 22, 2024
Copy link
Collaborator

@jsdw jsdw Aug 22, 2024

Choose a reason for hiding this comment

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

This doesn't appear to be exposed anywhere, or am I missing something? :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand your comment, what do you mean?

The entire module?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh no nevermind; I just didn't see any pub mod reconnecting_rpc_client but just missed that, prob because this PR didn't need to add it and I forgot it was already there :) I thought I was being dumb when I added that comment!

@jsdw
Copy link
Collaborator

jsdw commented Aug 22, 2024

This looks solid to me; just some small comments + it needs actually exposing by the looks of it :)

subxt/Cargo.toml Outdated Show resolved Hide resolved
@niklasad1 niklasad1 requested a review from a team as a code owner August 23, 2024 13:26
//!
//! # Example
//!
//! ```no_run
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice!

Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

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

One teeny nit re the reconnect Future/Stream thing left but otherwise looks clean to me; nice work!

@niklasad1 niklasad1 merged commit 4bc27d4 into master Aug 27, 2024
13 checks passed
@niklasad1 niklasad1 deleted the add-dedicated-subxt-rpc-reconn-client branch August 27, 2024 13:18
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.

3 participants