From 1cb7e06d778bbc0e679ea8cd4d6b9cf7684d5d0b Mon Sep 17 00:00:00 2001 From: fakeshadow <24548779@qq.com> Date: Mon, 15 Feb 2021 15:56:41 -0800 Subject: [PATCH] add additional comment in test for runtime behavior --- actix-http/src/client/pool.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/actix-http/src/client/pool.rs b/actix-http/src/client/pool.rs index d54a07fc1..b0b1613ab 100644 --- a/actix-http/src/client/pool.rs +++ b/actix-http/src/client/pool.rs @@ -529,7 +529,14 @@ mod test { actix_rt::task::yield_now().await; let conn = pool.call(req).await.unwrap(); + // Note: spawned recycle connection is not ran yet. + // This is tokio current thread runtime specific behavior. assert_eq!(2, generated_clone.get()); + + // yield task so the old connection is properly dropped. + actix_rt::task::yield_now().await; + assert_eq!(1, generated_clone.get()); + release(conn); } @@ -564,7 +571,14 @@ mod test { actix_rt::task::yield_now().await; let conn = pool.call(req).await.unwrap(); + // Note: spawned recycle connection is not ran yet. + // This is tokio current thread runtime specific behavior. assert_eq!(2, generated_clone.get()); + + // yield task so the old connection is properly dropped. + actix_rt::task::yield_now().await; + assert_eq!(1, generated_clone.get()); + release(conn); }