You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to create a subscriber and used your rust_pubsub example as a guide. However, I think there is a mistake:
What happens
The pubsub example exists in the first call of executor.spin(SpinOptions::default()).first_error()
Why i think this happens
The SimpleSubscriptionNode takes the executor as an input but does not store it as an attribute. When the constructor returns, it will lose the reference to the executor. When this happens, the executor drops the weakref to the node resulting in spinning nothing:
if self.nodes_mtx.lock().unwrap().is_empty() {
// Nothing to spin for, so just quit here
return Vec::new();
}
I'm a bit occupied with my project, otherwise I would submit a PR. But it could also make sense to raise a warning if the executor has no references left.
The text was updated successfully, but these errors were encountered:
Indeed, this example is caught in the middle of a transition right now. It was working before #428 (by explicitly holding the node as you're doing here), and it'll work again after #446, but since #446 was broken down into a series of separate PRs, I overlooked that this example doesn't work until the PR series is finished.
Rather than add a field to the struct to explicitly keep the node alive, I'd like to support the RAII relationship between Subscription and Node as soon as possible. I'll open a minimal PR to make the example work as-is, and I'll add a test case that catches this usage pattern.
I was trying to create a subscriber and used your rust_pubsub example as a guide. However, I think there is a mistake:
What happens
The pubsub example exists in the first call of executor.spin(SpinOptions::default()).first_error()
Why i think this happens
The SimpleSubscriptionNode takes the executor as an input but does not store it as an attribute. When the constructor returns, it will lose the reference to the executor. When this happens, the executor drops the weakref to the node resulting in spinning nothing:
Quickfix
Assign the node to the subscriber
I'm a bit occupied with my project, otherwise I would submit a PR. But it could also make sense to raise a warning if the executor has no references left.
The text was updated successfully, but these errors were encountered: