relax timeout

This commit is contained in:
fakeshadow 2021-04-03 02:43:46 +08:00
parent 1b63a7a4d7
commit f541f51f17
1 changed files with 4 additions and 2 deletions

View File

@ -226,7 +226,7 @@ async fn test_max_concurrent_connections() {
let counter = counter.clone(); let counter = counter.clone();
async move { async move {
counter.fetch_add(1, Ordering::SeqCst); counter.fetch_add(1, Ordering::SeqCst);
actix_rt::time::sleep(time::Duration::from_secs(3)).await; actix_rt::time::sleep(time::Duration::from_secs(20)).await;
counter.fetch_sub(1, Ordering::SeqCst); counter.fetch_sub(1, Ordering::SeqCst);
Ok::<(), ()>(()) Ok::<(), ()>(())
} }
@ -249,6 +249,8 @@ async fn test_max_concurrent_connections() {
conns.push(conn); conns.push(conn);
} }
actix_rt::time::sleep(time::Duration::from_secs(5)).await;
// counter would remain at 3 even with 12 successful connection. // counter would remain at 3 even with 12 successful connection.
// and 9 of them remain in backlog. // and 9 of them remain in backlog.
assert_eq!(max_conn, counter_clone.load(Ordering::SeqCst)); assert_eq!(max_conn, counter_clone.load(Ordering::SeqCst));
@ -257,7 +259,7 @@ async fn test_max_concurrent_connections() {
conn.shutdown().await.unwrap(); conn.shutdown().await.unwrap();
} }
srv.stop(true).await; srv.stop(false).await;
sys.stop(); sys.stop();
let _ = h.join().unwrap(); let _ = h.join().unwrap();