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

Probe only retains weak handle to Rc #543

Merged
merged 1 commit into from
Feb 5, 2024
Merged
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
12 changes: 7 additions & 5 deletions timely/src/dataflow/operators/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub trait Probe<G: Scope, D: Container> {
/// }
/// }).unwrap();
/// ```
fn probe_with(&self, handle: &mut Handle<G::Timestamp>) -> StreamCore<G, D>;
fn probe_with(&self, handle: &Handle<G::Timestamp>) -> StreamCore<G, D>;
}

impl<G: Scope, D: Container> Probe<G, D> for StreamCore<G, D> {
Expand All @@ -87,14 +87,14 @@ impl<G: Scope, D: Container> Probe<G, D> for StreamCore<G, D> {
self.probe_with(&mut handle);
handle
}
fn probe_with(&self, handle: &mut Handle<G::Timestamp>) -> StreamCore<G, D> {
fn probe_with(&self, handle: &Handle<G::Timestamp>) -> StreamCore<G, D> {

let mut builder = OperatorBuilder::new("Probe".to_owned(), self.scope());
let mut input = PullCounter::new(builder.new_input(self, Pipeline));
let (tee, stream) = builder.new_output();
let mut output = PushBuffer::new(PushCounter::new(tee));

let shared_frontier = handle.frontier.clone();
let shared_frontier = Rc::downgrade(&handle.frontier);
let mut started = false;

let mut vector = Default::default();
Expand All @@ -103,8 +103,10 @@ impl<G: Scope, D: Container> Probe<G, D> for StreamCore<G, D> {
move |progress| {

// surface all frontier changes to the shared frontier.
let mut borrow = shared_frontier.borrow_mut();
borrow.update_iter(progress.frontiers[0].drain());
if let Some(shared_frontier) = shared_frontier.upgrade() {
let mut borrow = shared_frontier.borrow_mut();
borrow.update_iter(progress.frontiers[0].drain());
}

if !started {
// discard initial capability.
Expand Down
Loading