File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -776,13 +776,9 @@ impl Client {
776776 } ;
777777
778778 if let Some ( timeout) = self . timeout {
779- tokio:: select! {
780- res = do_req => {
781- res
782- }
783- _ = tokio:: time:: sleep( timeout) => {
784- Err ( ClientError :: Timeout )
785- }
779+ match tokio:: time:: timeout ( timeout, do_req) . await {
780+ Ok ( res) => res,
781+ Err ( _) => Err ( ClientError :: Timeout ) ,
786782 }
787783 } else {
788784 do_req. await
@@ -923,13 +919,9 @@ impl Client {
923919 } ;
924920
925921 if let Some ( timeout) = self . timeout {
926- tokio:: select! {
927- res = do_req => {
928- res
929- }
930- _ = tokio:: time:: sleep( timeout) => {
931- Err ( ClientError :: Timeout )
932- }
922+ match tokio:: time:: timeout ( timeout, do_req) . await {
923+ Ok ( res) => res,
924+ Err ( _) => Err ( ClientError :: Timeout ) ,
933925 }
934926 } else {
935927 do_req. await
Original file line number Diff line number Diff line change @@ -175,13 +175,9 @@ impl Client {
175175 } ;
176176
177177 if let Some ( timeout) = self . timeout {
178- tokio:: select! {
179- res = do_req => {
180- res
181- }
182- _ = tokio:: time:: sleep( timeout) => {
183- Err ( ClientError :: Timeout )
184- }
178+ match tokio:: time:: timeout ( timeout, do_req) . await {
179+ Ok ( res) => res,
180+ Err ( _) => Err ( ClientError :: Timeout ) ,
185181 }
186182 } else {
187183 do_req. await
You can’t perform that action at this time.
0 commit comments