Skip to content

Commit

Permalink
Unwrap tokio::task::Builder::spawn() to support updated tokio task …
Browse files Browse the repository at this point in the history
…builder API (#2349)
  • Loading branch information
zackradisic authored Mar 8, 2023
1 parent c25b09f commit f42ec02
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/internal/tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ where
F: Future<Output = T> + Send + 'static,
T: Send + 'static,
{
tokio::task::Builder::new().name(&*format!("serenity::{}", name)).spawn(future)
tokio::task::Builder::new()
.name(&*format!("serenity::{}", name))
.spawn(future)
.expect("called outside tokio runtime")
}

#[cfg(not(all(tokio_unstable, feature = "tokio_task_builder")))]
Expand Down

2 comments on commit f42ec02

@isothiazol
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great.

@kangalio
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great.

Sarcastic?

Please sign in to comment.