remove unnecessary yield_nows

This commit is contained in:
Bryan Stitt 2023-09-21 11:22:20 -07:00
parent f9b6c2fe0c
commit 9b2f27862d
4 changed files with 1 additions and 13 deletions

View File

@ -52,7 +52,7 @@ use std::sync::{atomic, Arc};
use std::time::Duration; use std::time::Duration;
use tokio::select; use tokio::select;
use tokio::sync::{broadcast, mpsc, oneshot, watch, Semaphore}; use tokio::sync::{broadcast, mpsc, oneshot, watch, Semaphore};
use tokio::task::{yield_now, JoinHandle}; use tokio::task::JoinHandle;
use tokio::time::{sleep, timeout, Instant}; use tokio::time::{sleep, timeout, Instant};
use tracing::{error, info, trace, warn, Level}; use tracing::{error, info, trace, warn, Level};
@ -551,7 +551,6 @@ impl Web3ProxyApp {
_ = new_top_config_receiver.changed() => {} _ = new_top_config_receiver.changed() => {}
} }
} }
yield_now().await;
} }
Ok(()) Ok(())

View File

@ -36,7 +36,6 @@ use std::sync::atomic::AtomicU64;
use std::sync::Arc; use std::sync::Arc;
use tokio::select; use tokio::select;
use tokio::sync::{broadcast, mpsc, OwnedSemaphorePermit, RwLock as AsyncRwLock}; use tokio::sync::{broadcast, mpsc, OwnedSemaphorePermit, RwLock as AsyncRwLock};
use tokio::task::yield_now;
use tracing::trace; use tracing::trace;
/// How to select backend servers for a request /// How to select backend servers for a request
@ -550,8 +549,6 @@ async fn read_web3_socket(
}; };
tokio::spawn(f); tokio::spawn(f);
yield_now().await;
} else { } else {
break; break;
} }

View File

@ -31,7 +31,6 @@ use std::sync::atomic::Ordering;
use std::sync::Arc; use std::sync::Arc;
use tokio::select; use tokio::select;
use tokio::sync::{mpsc, watch}; use tokio::sync::{mpsc, watch};
use tokio::task::yield_now;
use tokio::time::{sleep_until, timeout, Duration, Instant}; use tokio::time::{sleep_until, timeout, Duration, Instant};
use tracing::{debug, error, info, instrument, trace, warn}; use tracing::{debug, error, info, instrument, trace, warn};
@ -1183,8 +1182,6 @@ impl Web3Rpcs {
// consensus rpcs changed! // consensus rpcs changed!
watch_consensus_rpcs.borrow_and_update(); watch_consensus_rpcs.borrow_and_update();
yield_now().await;
// continue to try again // continue to try again
continue; continue;
} }
@ -1226,8 +1223,6 @@ impl Web3Rpcs {
} }
} }
yield_now().await;
continue; continue;
} else { } else {
warn!(?self, "all rate limits exceeded"); warn!(?self, "all rate limits exceeded");

View File

@ -26,7 +26,6 @@ use std::hash::{Hash, Hasher};
use std::sync::atomic::{self, AtomicU32, AtomicU64, AtomicUsize}; use std::sync::atomic::{self, AtomicU32, AtomicU64, AtomicUsize};
use std::{cmp::Ordering, sync::Arc}; use std::{cmp::Ordering, sync::Arc};
use tokio::sync::{mpsc, watch, RwLock as AsyncRwLock}; use tokio::sync::{mpsc, watch, RwLock as AsyncRwLock};
use tokio::task::yield_now;
use tokio::time::{interval, sleep, sleep_until, Duration, Instant, MissedTickBehavior}; use tokio::time::{interval, sleep, sleep_until, Duration, Instant, MissedTickBehavior};
use tracing::{debug, error, info, trace, warn, Level}; use tracing::{debug, error, info, trace, warn, Level};
use url::Url; use url::Url;
@ -692,8 +691,6 @@ impl Web3Rpc {
break; break;
} }
yield_now().await;
disconnect_watch_rx.changed().await?; disconnect_watch_rx.changed().await?;
} }
trace!("disconnect triggered on {}", rpc); trace!("disconnect triggered on {}", rpc);