Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure systemd service restart period #112

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions zenoh-bridge-ros2dds/.service/zenoh-bridge-ros2dds.service
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ KillMode=mixed
KillSignal=SIGINT
RestartKillSignal=SIGINT
Restart=on-failure
RestartSec=2
PermissionsStartOnly=true
User=zenoh-bridge-ros2dds
StandardOutput=syslog
Expand Down
17 changes: 14 additions & 3 deletions zenoh-bridge-ros2dds/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,28 @@ async fn main() {
}

// create a zenoh Runtime (to share with plugins)
let runtime = zenoh::runtime::Runtime::new(config).await.unwrap();
let runtime = zenoh::runtime::Runtime::new(config)
.await
.unwrap_or_else(|e| {
println!("{e}. Exiting...");
std::process::exit(-1);
});

// start REST plugin
if rest_plugin {
use zenoh_plugin_trait::Plugin;
zenoh_plugin_rest::RestPlugin::start("rest", &runtime).unwrap();
zenoh_plugin_rest::RestPlugin::start("rest", &runtime).unwrap_or_else(|e| {
println!("{e}. Exiting...");
std::process::exit(-1);
});
}

// start DDS plugin
use zenoh_plugin_trait::Plugin;
zenoh_plugin_ros2dds::ROS2Plugin::start("ros2dds", &runtime).unwrap();
zenoh_plugin_ros2dds::ROS2Plugin::start("ros2dds", &runtime).unwrap_or_else(|e| {
println!("{e}. Exiting...");
std::process::exit(-1);
});
async_std::future::pending::<()>().await;
}

Expand Down