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

Address review on stable-futures #1373

Merged
merged 4 commits into from
Jan 6, 2020
Merged
Changes from 2 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
10 changes: 7 additions & 3 deletions core/src/nodes/tasks/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub struct Manager<I, O, H, E, HE, T, C = PeerId> {
/// `local_spawns` list instead.
threads_pool: Option<ThreadPool>,

/// If no executor is available, we move tasks to this list, and futures are polled on the
/// If no executor is available, we move tasks to this set, and futures are polled on the
/// current thread instead.
local_spawns: FuturesUnordered<Pin<Box<dyn Future<Output = ()> + Send>>>,

Expand Down Expand Up @@ -237,7 +237,12 @@ impl<I, O, H, E, HE, T, C> Manager<I, O, H, E, HE, T, C> {
let msg = ToTaskMessage::HandlerEvent(event.clone());
match task.sender.start_send(msg) {
Ok(()) => {},
Err(ref err) if err.is_full() => {}, // TODO: somehow report to user?
Err(ref err) if err.is_full() => {
// Note that the user is expected to call `poll_ready_broadcast` beforehand,
// which returns `Poll::Ready` only if the channel isn't full. Reaching this
// path always indicates a mistake in the code.
log::warn!("start_broadcast called while channel was full. Have you called `poll_ready_broadcast` before?");
},
Err(_) => {},
}
}
Expand Down Expand Up @@ -470,4 +475,3 @@ impl<E, T: fmt::Debug> fmt::Debug for ClosedTask<E, T> {
.finish()
}
}