File tree 1 file changed +10
-5
lines changed
1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -556,9 +556,11 @@ pub async fn start(
556
556
let cancel = cancel. clone ( ) ;
557
557
async move {
558
558
// cancel stuff if this loop breaks
559
- let _drop_guard = cancel. drop_guard ( ) ;
559
+ let _drop_guard = cancel. clone ( ) . drop_guard ( ) ;
560
560
561
- while let Some ( decode_res) = stream. next ( ) . await {
561
+ while let Outcome :: Completed ( Some ( decode_res) ) =
562
+ stream. next ( ) . preemptible ( cancel. cancelled ( ) ) . await
563
+ {
562
564
let msg = match decode_res {
563
565
Ok ( msg) => msg,
564
566
Err ( PgWireError :: IoError ( io_error) ) => {
@@ -585,9 +587,9 @@ pub async fn start(
585
587
break ;
586
588
}
587
589
} ;
588
-
589
590
front_tx. send ( msg) . await ?;
590
591
}
592
+
591
593
debug ! ( "frontend stream is done" ) ;
592
594
593
595
Ok :: < _ , BoxError > ( ( ) )
@@ -597,8 +599,11 @@ pub async fn start(
597
599
tokio:: spawn ( {
598
600
let cancel = cancel. clone ( ) ;
599
601
async move {
600
- let _drop_guard = cancel. drop_guard ( ) ;
601
- while let Some ( back) = back_rx. recv ( ) . await {
602
+ let _drop_guard = cancel. clone ( ) . drop_guard ( ) ;
603
+
604
+ while let Outcome :: Completed ( Some ( back) ) =
605
+ back_rx. recv ( ) . preemptible ( cancel. cancelled ( ) ) . await
606
+ {
602
607
match back {
603
608
BackendResponse :: Message { message, flush } => {
604
609
if let PgWireBackendMessage :: ErrorResponse ( e) = & message {
You can’t perform that action at this time.
0 commit comments