Skip to content

Commit

Permalink
sqlx_core::rt::timeout: box futures in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
joeydewaal committed Jan 25, 2025
1 parent 80a6142 commit 00cff28
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sqlx-core/src/rt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ pub enum JoinHandle<T> {
}

pub async fn timeout<F: Future>(duration: Duration, f: F) -> Result<F::Output, TimeoutError> {
// Box futures in debug mode to decrease stack size
#[cfg(debug_assertions)]
let f = Box::pin(f);

#[cfg(feature = "_rt-tokio")]
if rt_tokio::available() {
return tokio::time::timeout(duration, f)
Expand Down

0 comments on commit 00cff28

Please sign in to comment.