diff options
author | hozan23 <hozan23@karyontech.net> | 2024-05-23 00:19:58 +0200 |
---|---|---|
committer | hozan23 <hozan23@karyontech.net> | 2024-05-23 00:19:58 +0200 |
commit | 2d1a8aea0b9330cd2eaad26eb187644adad6bed9 (patch) | |
tree | 6083adaa09ae2f0ef2912f7934cdf0bfafff1654 /jsonrpc/examples/tokio_server | |
parent | cc1d61c401e52ba3b6cd264c5400fb7ab52522dc (diff) |
jsonrpc: spawn task when handle new request
Diffstat (limited to 'jsonrpc/examples/tokio_server')
-rw-r--r-- | jsonrpc/examples/tokio_server/src/main.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/jsonrpc/examples/tokio_server/src/main.rs b/jsonrpc/examples/tokio_server/src/main.rs index ce77cd3..d70a46a 100644 --- a/jsonrpc/examples/tokio_server/src/main.rs +++ b/jsonrpc/examples/tokio_server/src/main.rs @@ -1,4 +1,4 @@ -use std::sync::Arc; +use std::{sync::Arc, time::Duration}; use serde::{Deserialize, Serialize}; use serde_json::Value; @@ -56,5 +56,7 @@ async fn main() { .expect("start a new server"); // Start the server - server.start().await.unwrap(); + server.start().await; + + tokio::time::sleep(Duration::MAX).await; } |