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

Fix orchestrator not dying after being killed #1391

Merged
merged 1 commit into from
Sep 10, 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
7 changes: 7 additions & 0 deletions zenoh/src/net/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,13 @@ impl Runtime {
Ok(())
}

pub fn is_closed(&self) -> bool {
self.state
.task_controller
.get_cancellation_token()
.is_cancelled()
}

pub fn new_timestamp(&self) -> Option<uhlc::Timestamp> {
self.state.hlc.as_ref().map(|hlc| hlc.new_timestamp())
}
Expand Down
5 changes: 5 additions & 0 deletions zenoh/src/net/runtime/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1137,10 +1137,15 @@ impl Runtime {
}

pub(super) fn closing_session(session: &RuntimeSession) {
if session.runtime.is_closed() {
return;
}

match session.runtime.whatami() {
WhatAmI::Client => {
let runtime = session.runtime.clone();
let cancellation_token = runtime.get_cancellation_token();

session.runtime.spawn(async move {
let retry_config = runtime.get_global_connect_retry_config();
let mut period = retry_config.period();
Expand Down