aboutsummaryrefslogtreecommitdiff
path: root/jsonrpc/examples/server.rs
diff options
context:
space:
mode:
authorhozan23 <hozan23@karyontech.net>2024-05-23 00:19:58 +0200
committerhozan23 <hozan23@karyontech.net>2024-05-23 00:19:58 +0200
commit2d1a8aea0b9330cd2eaad26eb187644adad6bed9 (patch)
tree6083adaa09ae2f0ef2912f7934cdf0bfafff1654 /jsonrpc/examples/server.rs
parentcc1d61c401e52ba3b6cd264c5400fb7ab52522dc (diff)
jsonrpc: spawn task when handle new request
Diffstat (limited to 'jsonrpc/examples/server.rs')
-rw-r--r--jsonrpc/examples/server.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/jsonrpc/examples/server.rs b/jsonrpc/examples/server.rs
index 5b951cd..470bd02 100644
--- a/jsonrpc/examples/server.rs
+++ b/jsonrpc/examples/server.rs
@@ -1,8 +1,9 @@
-use std::sync::Arc;
+use std::{sync::Arc, time::Duration};
use serde::{Deserialize, Serialize};
use serde_json::Value;
+use karyon_core::async_util::sleep;
use karyon_jsonrpc::{rpc_impl, Error, Server};
struct Calc {
@@ -56,6 +57,8 @@ fn main() {
.expect("start a new server");
// Start the server
- server.start().await.unwrap();
+ server.start().await;
+
+ sleep(Duration::MAX).await;
});
}