Skip to content
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
7 changes: 7 additions & 0 deletions vortex-io/src/runtime/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::task::Poll;
use std::task::ready;

use futures::FutureExt;
use tracing::Instrument;
use vortex_error::vortex_panic;

use crate::runtime::AbortHandleRef;
Expand Down Expand Up @@ -65,11 +66,13 @@ impl Handle {
R: Send + 'static,
{
let (send, recv) = oneshot::channel();
let span = tracing::Span::current();
let abort_handle = self.runtime().spawn(
async move {
// Task::detach allows the receiver to be dropped, so we ignore send errors.
drop(send.send(f.await));
}
.instrument(span)
.boxed(),
);
Task {
Expand Down Expand Up @@ -103,7 +106,9 @@ impl Handle {
R: Send + 'static,
{
let (send, recv) = oneshot::channel();
let span = tracing::Span::current();
let abort_handle = self.runtime().spawn_cpu(Box::new(move || {
let _guard = span.enter();
// Optimistically avoid the work if the result won't be used.
if !send.is_closed() {
// Task::detach allows the receiver to be dropped, so we ignore send errors.
Expand All @@ -123,7 +128,9 @@ impl Handle {
R: Send + 'static,
{
let (send, recv) = oneshot::channel();
let span = tracing::Span::current();
let abort_handle = self.runtime().spawn_blocking_io(Box::new(move || {
let _guard = span.enter();
// Optimistically avoid the work if the result won't be used.
if !send.is_closed() {
// Task::detach allows the receiver to be dropped, so we ignore send errors.
Expand Down
Loading