mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: dont await changes (#7760)
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
use crate::ExExEvent;
|
||||||
|
use metrics::Gauge;
|
||||||
|
use reth_metrics::{metrics::Counter, Metrics};
|
||||||
|
use reth_primitives::{BlockNumber, FinishedExExHeight};
|
||||||
|
use reth_provider::CanonStateNotification;
|
||||||
|
use reth_tracing::tracing::debug;
|
||||||
use std::{
|
use std::{
|
||||||
collections::VecDeque,
|
collections::VecDeque,
|
||||||
future::{poll_fn, Future},
|
future::{poll_fn, Future},
|
||||||
@ -8,14 +14,6 @@ use std::{
|
|||||||
},
|
},
|
||||||
task::{Context, Poll},
|
task::{Context, Poll},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::ExExEvent;
|
|
||||||
use futures::StreamExt;
|
|
||||||
use metrics::Gauge;
|
|
||||||
use reth_metrics::{metrics::Counter, Metrics};
|
|
||||||
use reth_primitives::{BlockNumber, FinishedExExHeight};
|
|
||||||
use reth_provider::CanonStateNotification;
|
|
||||||
use reth_tracing::tracing::debug;
|
|
||||||
use tokio::sync::{
|
use tokio::sync::{
|
||||||
mpsc::{self, error::SendError, Receiver, UnboundedReceiver, UnboundedSender},
|
mpsc::{self, error::SendError, Receiver, UnboundedReceiver, UnboundedSender},
|
||||||
watch,
|
watch,
|
||||||
@ -347,6 +345,7 @@ pub struct ExExManagerHandle {
|
|||||||
/// otherwise unused.
|
/// otherwise unused.
|
||||||
is_ready_receiver: watch::Receiver<bool>,
|
is_ready_receiver: watch::Receiver<bool>,
|
||||||
/// A stream of bools denoting whether the manager is ready for new notifications.
|
/// A stream of bools denoting whether the manager is ready for new notifications.
|
||||||
|
#[allow(unused)]
|
||||||
is_ready: WatchStream<bool>,
|
is_ready: WatchStream<bool>,
|
||||||
/// The current capacity of the manager's internal notification buffer.
|
/// The current capacity of the manager's internal notification buffer.
|
||||||
current_capacity: Arc<AtomicUsize>,
|
current_capacity: Arc<AtomicUsize>,
|
||||||
@ -426,15 +425,14 @@ impl ExExManagerHandle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Wait until the manager is ready for new notifications.
|
/// Wait until the manager is ready for new notifications.
|
||||||
|
#[allow(clippy::needless_pass_by_ref_mut)]
|
||||||
pub fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<()> {
|
pub fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<()> {
|
||||||
// if this returns `Poll::Ready(None)` the stream is exhausted, which means the underlying
|
use futures as _;
|
||||||
// channel is closed.
|
// FIXME: if not ready this must be polled
|
||||||
//
|
if *self.is_ready_receiver.borrow() {
|
||||||
// this can only happen if the manager died, and the node is shutting down, so we ignore it
|
|
||||||
let mut pinned = std::pin::pin!(&mut self.is_ready);
|
|
||||||
if pinned.poll_next_unpin(cx) == Poll::Ready(Some(true)) {
|
|
||||||
Poll::Ready(())
|
Poll::Ready(())
|
||||||
} else {
|
} else {
|
||||||
|
cx.waker().wake_by_ref();
|
||||||
Poll::Pending
|
Poll::Pending
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user