Skip to content

Commit

Permalink
Fix hello_world_publisher example to not send before receiver matches…
Browse files Browse the repository at this point in the history
… us.
  • Loading branch information
jhelovuo committed Aug 1, 2024
1 parent 5c7bcc2 commit 2b2f10e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/hello_world_publisher/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ fn main() {
// If we get a matching subscription, trigger the send
DataWriterStatus::PublicationMatched{..} => {
println!("Matched with hello subscriber");
// Wait for a while so that subscriber also recognizes us.
// There is no two- or three-way handshake in pub/sub matching,
// so we cannot know if the other side is immediately ready.
Timer::after(Duration::from_secs(1)).await;
write_trigger_sender.send(()).await.unwrap();
}
_ =>
Expand Down

0 comments on commit 2b2f10e

Please sign in to comment.