Skip to content

Commit

Permalink
Fix orchestrator not dying after being killed
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzypixelz committed Sep 10, 2024
1 parent 16ddfad commit 00837d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
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

0 comments on commit 00837d3

Please sign in to comment.