Skip to content

Commit b2c9c8f

Browse files
committed
Made shutdown check biased.
1 parent 25ab2dc commit b2c9c8f

File tree

1 file changed

+6
-5
lines changed
  • example_apps/tutorial_app/src

1 file changed

+6
-5
lines changed

example_apps/tutorial_app/src/ui.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,14 @@ where
7373

7474
loop {
7575
let (stream, _) = select! {
76-
result = listener.accept() => result?,
76+
biased;
7777
_ = &mut shutdown => {
78-
tokio::time::timeout(Duration::from_secs(2), shutdown_handle.shutdown())
79-
.await
80-
.map_err(|_| TimeoutError)?;
81-
return Ok(());
78+
tokio::time::timeout(Duration::from_secs(2), shutdown_handle.shutdown())
79+
.await
80+
.map_err(|_| TimeoutError)?;
81+
return Ok(());
8282
}
83+
result = listener.accept() => result?,
8384
};
8485

8586
let conn = Builder::new().serve_connection(TokioIo::new(stream), make_svc.clone());

0 commit comments

Comments
 (0)