From b6e9d0184678c2f4e8675bb74c2b825345864ace Mon Sep 17 00:00:00 2001 From: Daniyar Itegulov Date: Wed, 18 Dec 2024 19:51:10 +1100 Subject: [PATCH] clarify jsonrpsee caveat + link to docs --- crates/api_server/src/server.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/api_server/src/server.rs b/crates/api_server/src/server.rs index 3ee74dbc..8bd9de15 100644 --- a/crates/api_server/src/server.rs +++ b/crates/api_server/src/server.rs @@ -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))) } } @@ -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() }