Skip to content

Commit

Permalink
Also move the subscriber into a separate task, otherwise it will neve…
Browse files Browse the repository at this point in the history
…r run since the reflector looping forever

Signed-off-by: Natalie Klestrup Röijezon <nat@nullable.se>
  • Loading branch information
nightkr committed Nov 2, 2024
1 parent e161079 commit 71de1bd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions kube-runtime/src/utils/watch_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ pub trait WatchStreamExt: Stream {
/// }
/// });
///
/// tokio::spawn(async move {
/// // subscriber can be used to receive applied_objects
/// subscriber.for_each(|obj| async move {
/// info!("saw in subscriber {}", &obj.name_any())
/// }).await;
/// });
///
/// // configure the watcher stream and populate the store while polling
/// watcher(deploys, watcher::Config::default())
/// .reflect_shared(writer)
Expand All @@ -250,11 +257,6 @@ pub trait WatchStreamExt: Stream {
/// })
/// .await;
///
/// // subscriber can be used to receive applied_objects
/// subscriber.for_each(|obj| async move {
/// info!("saw in subscriber {}", &obj.name_any())
/// }).await;
///
/// # Ok(())
/// # }
/// ```
Expand Down

0 comments on commit 71de1bd

Please sign in to comment.