Skip to content

Commit

Permalink
clarify jsonrpsee caveat + link to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
itegulov committed Dec 18, 2024
1 parent c10dcd9 commit b6e9d01
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/api_server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ impl NodeServerBuilder {

let server = server_builder.build(addr).await.unwrap();
let rpc = Self::default_rpc(self.node);
// `jsonrpsee` does `tokio::spawn` within `start` method, so we cannot invoke it here, as this method
// should only build the server. This way we delay the launch until the `NodeServer::run` is invoked.
NodeServer(Box::new(move || server.start(rpc)))
}
}
Expand All @@ -98,6 +100,8 @@ impl NodeServer {
/// Start responding to connections requests.
///
/// This will run on the tokio runtime until the server is stopped or the `ServerHandle` is dropped.
///
/// See [`ServerHandle`](https://docs.rs/jsonrpsee-server/latest/jsonrpsee_server/struct.ServerHandle.html) docs for more details.
pub fn run(self) -> ServerHandle {
self.0()
}
Expand Down

0 comments on commit b6e9d01

Please sign in to comment.