reactive_graph_client/client/system/
shutdown.rs

1use std::sync::Arc;
2
3use crate::client::error::CommandError::Rejected;
4use crate::client::result::CommandResult;
5use reactive_graph_client::ReactiveGraphClient;
6
7pub(crate) async fn shutdown(client: &Arc<ReactiveGraphClient>) -> CommandResult {
8    match client.runtime().shutdown().shutdown().await {
9        Ok(true) => Ok("Shutting down...".into()),
10        Ok(false) => Err(Rejected("Server rejected shutdown".to_string())),
11        Err(e) => Err(e.into()),
12    }
13}