MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / exec_ping

Function exec_ping

crates/cli/src/subcommands/server.rs:284–303  ·  view source on GitHub ↗
(config: Config, args: &ArgMatches)

Source from the content-addressed store, hash-verified

282}
283
284pub async fn exec_ping(config: Config, args: &ArgMatches) -> Result<(), anyhow::Error> {
285 let server = args.get_one::<String>("server").unwrap().as_str();
286 let url = config.get_host_url(Some(server))?;
287
288 let builder = reqwest::Client::new().get(format!("{url}/v1/ping").as_str());
289 let response = builder.send().await?;
290
291 match response.status() {
292 reqwest::StatusCode::OK => {
293 println!("Server is online: {url}");
294 }
295 reqwest::StatusCode::NOT_FOUND => {
296 println!("Server returned 404 (Not Found): {url}");
297 }
298 err => {
299 println!("Server could not be reached ({err}): {url}");
300 }
301 }
302 Ok(())
303}
304
305pub async fn exec_edit(mut config: Config, args: &ArgMatches) -> Result<(), anyhow::Error> {
306 let server = args.get_one::<String>("server").unwrap().as_str();

Callers 1

exec_subcommandFunction · 0.85

Calls 8

get_host_urlMethod · 0.80
statusMethod · 0.80
sendMethod · 0.65
newFunction · 0.50
OkFunction · 0.50
as_strMethod · 0.45
unwrapMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…